fix minio connection issue
This commit is contained in:
parent
c7af8b2022
commit
e0461400f9
|
@ -21,9 +21,10 @@ from prefect.task_runners import ConcurrentTaskRunner
|
||||||
def stop_at_floor(floor: int) -> None:
|
def stop_at_floor(floor: int) -> None:
|
||||||
|
|
||||||
logger = get_run_logger()
|
logger = get_run_logger()
|
||||||
|
|
||||||
logger.info(f'elevator moving to floor {floor}')
|
logger.info(f'elevator moving to floor {floor}')
|
||||||
|
|
||||||
time.sleep(floor)
|
time.sleep(floor)
|
||||||
|
|
||||||
logger.info(f'elevator stops on floor {floor}')
|
logger.info(f'elevator stops on floor {floor}')
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,9 +33,18 @@ def stop_at_floor(floor: int) -> None:
|
||||||
task_runner=ConcurrentTaskRunner(),
|
task_runner=ConcurrentTaskRunner(),
|
||||||
timeout_seconds=60)
|
timeout_seconds=60)
|
||||||
def elevator():
|
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):
|
for floor in range(5, 0, -1):
|
||||||
stop_at_floor.submit(floor)
|
stop_at_floor.submit(floor)
|
||||||
|
|
||||||
|
logger.info('Elevator stop.')
|
||||||
|
|
||||||
|
|
||||||
def build_deployment() -> None:
|
def build_deployment() -> None:
|
||||||
""" Deploy flow to docker-based Prefect server """
|
""" Deploy flow to docker-based Prefect server """
|
||||||
|
@ -48,7 +58,7 @@ def build_deployment() -> None:
|
||||||
'USE_SSL': False,
|
'USE_SSL': False,
|
||||||
'AWS_ACCESS_KEY_ID': 'root',
|
'AWS_ACCESS_KEY_ID': 'root',
|
||||||
'AWS_SECRET_ACCESS_KEY': 'minio_password',
|
'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,
|
'use_ssl': False,
|
||||||
'key': 'root',
|
'key': 'root',
|
||||||
'secret': 'minio_password',
|
'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()
|
deployment.apply()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
build_deployment()
|
build_deployment()
|
|
@ -3,6 +3,7 @@ version: '3.7'
|
||||||
networks:
|
networks:
|
||||||
prefect:
|
prefect:
|
||||||
name: prefect
|
name: prefect
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
services:
|
services:
|
||||||
minio:
|
minio:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
###
|
###
|
||||||
name: test_prefect
|
name: test_prefect
|
||||||
description: this is a cute elevator
|
description: this is a cute elevator
|
||||||
version: 44e21b51f98000011b5960b821f33b31
|
version: dbc4b56ef8661a4c539ee011541b4df0
|
||||||
# The work queue that will handle this deployment's runs
|
# The work queue that will handle this deployment's runs
|
||||||
work_queue_name: default
|
work_queue_name: default
|
||||||
work_pool_name: default-agent-pool
|
work_pool_name: default-agent-pool
|
||||||
|
@ -25,7 +25,7 @@ infrastructure:
|
||||||
USE_SSL: 'False'
|
USE_SSL: 'False'
|
||||||
AWS_ACCESS_KEY_ID: root
|
AWS_ACCESS_KEY_ID: root
|
||||||
AWS_SECRET_ACCESS_KEY: minio_password
|
AWS_SECRET_ACCESS_KEY: minio_password
|
||||||
ENDPOINT_URL: http://127.0.0.1:9000
|
ENDPOINT_URL: http://172.28.0.2:9000
|
||||||
labels: {}
|
labels: {}
|
||||||
name: null
|
name: null
|
||||||
command: null
|
command: null
|
||||||
|
@ -42,8 +42,8 @@ infrastructure:
|
||||||
mem_limit: null
|
mem_limit: null
|
||||||
privileged: false
|
privileged: false
|
||||||
_is_anonymous: false
|
_is_anonymous: false
|
||||||
_block_document_name: test-prefec-infra
|
_block_document_name: test-prefect-infra
|
||||||
_block_document_id: c0336aea-3d1e-4c77-b2fe-66e53263a1cc
|
_block_document_id: 1a3e6676-163e-464b-bd30-fd0d7be65e28
|
||||||
block_type_slug: docker-container
|
block_type_slug: docker-container
|
||||||
_block_type_slug: docker-container
|
_block_type_slug: docker-container
|
||||||
storage:
|
storage:
|
||||||
|
@ -53,7 +53,7 @@ storage:
|
||||||
key: root
|
key: root
|
||||||
secret: minio_password
|
secret: minio_password
|
||||||
client_kwargs:
|
client_kwargs:
|
||||||
endpoint_url: http://127.0.0.1:9000
|
endpoint_url: http://localhost:9000
|
||||||
_is_anonymous: false
|
_is_anonymous: false
|
||||||
_block_document_name: test-prefect-storage
|
_block_document_name: test-prefect-storage
|
||||||
_block_document_id: 9d763296-4114-4a72-8fa7-c9c7c2464b9c
|
_block_document_id: 9d763296-4114-4a72-8fa7-c9c7c2464b9c
|
||||||
|
@ -67,4 +67,4 @@ parameter_openapi_schema:
|
||||||
properties: {}
|
properties: {}
|
||||||
required: null
|
required: null
|
||||||
definitions: 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