Compare commits
2 Commits
c7af8b2022
...
b736e8f082
Author | SHA1 | Date |
---|---|---|
|
b736e8f082 | |
|
e0461400f9 |
|
@ -21,9 +21,10 @@ from prefect.task_runners import ConcurrentTaskRunner
|
|||
def stop_at_floor(floor: int) -> None:
|
||||
|
||||
logger = get_run_logger()
|
||||
|
||||
logger.info(f'elevator moving to floor {floor}')
|
||||
|
||||
time.sleep(floor)
|
||||
|
||||
logger.info(f'elevator stops on floor {floor}')
|
||||
|
||||
|
||||
|
@ -32,9 +33,18 @@ def stop_at_floor(floor: int) -> None:
|
|||
task_runner=ConcurrentTaskRunner(),
|
||||
timeout_seconds=60)
|
||||
def elevator():
|
||||
""" This is a small sample from official doc to run tasks concurrently
|
||||
ref: https://docs.prefect.io/latest/concepts/task-runners/
|
||||
"""
|
||||
|
||||
logger = get_run_logger()
|
||||
logger.info('Elevator start.')
|
||||
|
||||
for floor in range(5, 0, -1):
|
||||
stop_at_floor.submit(floor)
|
||||
|
||||
logger.info('Elevator stop.')
|
||||
|
||||
|
||||
def build_deployment() -> None:
|
||||
""" Deploy flow to docker-based Prefect server """
|
||||
|
@ -48,7 +58,7 @@ def build_deployment() -> None:
|
|||
'USE_SSL': False,
|
||||
'AWS_ACCESS_KEY_ID': 'root',
|
||||
'AWS_SECRET_ACCESS_KEY': 'minio_password',
|
||||
'ENDPOINT_URL': 'http://127.0.0.1:9000'
|
||||
'ENDPOINT_URL': 'http://172.28.0.2:9000'
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -58,7 +68,7 @@ def build_deployment() -> None:
|
|||
'use_ssl': False,
|
||||
'key': 'root',
|
||||
'secret': 'minio_password',
|
||||
'client_kwargs': {'endpoint_url': 'http://127.0.0.1:9000'}
|
||||
'client_kwargs': {'endpoint_url': 'http://localhost:9000'}
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -78,5 +88,7 @@ def build_deployment() -> None:
|
|||
|
||||
deployment.apply()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
build_deployment()
|
|
@ -3,6 +3,7 @@ version: '3.7'
|
|||
networks:
|
||||
prefect:
|
||||
name: prefect
|
||||
driver: bridge
|
||||
|
||||
services:
|
||||
minio:
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -3,7 +3,7 @@
|
|||
###
|
||||
name: test_prefect
|
||||
description: this is a cute elevator
|
||||
version: 44e21b51f98000011b5960b821f33b31
|
||||
version: dbc4b56ef8661a4c539ee011541b4df0
|
||||
# The work queue that will handle this deployment's runs
|
||||
work_queue_name: default
|
||||
work_pool_name: default-agent-pool
|
||||
|
@ -25,7 +25,7 @@ infrastructure:
|
|||
USE_SSL: 'False'
|
||||
AWS_ACCESS_KEY_ID: root
|
||||
AWS_SECRET_ACCESS_KEY: minio_password
|
||||
ENDPOINT_URL: http://127.0.0.1:9000
|
||||
ENDPOINT_URL: http://172.28.0.2:9000
|
||||
labels: {}
|
||||
name: null
|
||||
command: null
|
||||
|
@ -42,8 +42,8 @@ infrastructure:
|
|||
mem_limit: null
|
||||
privileged: false
|
||||
_is_anonymous: false
|
||||
_block_document_name: test-prefec-infra
|
||||
_block_document_id: c0336aea-3d1e-4c77-b2fe-66e53263a1cc
|
||||
_block_document_name: test-prefect-infra
|
||||
_block_document_id: 1a3e6676-163e-464b-bd30-fd0d7be65e28
|
||||
block_type_slug: docker-container
|
||||
_block_type_slug: docker-container
|
||||
storage:
|
||||
|
@ -53,7 +53,7 @@ storage:
|
|||
key: root
|
||||
secret: minio_password
|
||||
client_kwargs:
|
||||
endpoint_url: http://127.0.0.1:9000
|
||||
endpoint_url: http://localhost:9000
|
||||
_is_anonymous: false
|
||||
_block_document_name: test-prefect-storage
|
||||
_block_document_id: 9d763296-4114-4a72-8fa7-c9c7c2464b9c
|
||||
|
@ -67,4 +67,4 @@ parameter_openapi_schema:
|
|||
properties: {}
|
||||
required: null
|
||||
definitions: null
|
||||
timestamp: '2023-03-28T09:22:52.437835+00:00'
|
||||
timestamp: '2023-04-07T03:57:16.017250+00:00'
|
||||
|
|
Loading…
Reference in New Issue