Kyle McChesney
10/13/2021, 8:23 PMfrom settings import JOB_QUEUE, JOB_DEF
@task
def trigger_batch_job(input):
...
return BatchSubmit(
job_name=job_name,
job_definition=JOB_DEF,
job_queue=JOB_QUEUE,
batch_kwargs=...,
).run()
with Flow(...):
inputs = some_task()
wait_res = AWSClientWait(
client='batch',
waiter_name='JobComplete',
)(
waiter_kwargs={
'jobs': [
trigger_batch_job(inputs),
],
'WaiterConfig': {
'Delay': 10,
'MaxAttempts': 10000,
},
},
)
And a settings.py file that looks like:
# settings.py
import os
JOB_DEF = os.environ.get(
'PREFECT_FLOWS_JOB_DEF',
'job-latest',
)
JOB_QUEUE = os.environ.get(
'PREFECT_FLOWS_JOB_QUEUE',
'job-gpu-dev',
)
The idea here is to have dynamic values for these settings based on what environment this is running in (we have dev/test/prod AWS accounts)