Does anyone know how to run an AWS batch job and wait for completion?
k
Does anyone know how to run an AWS batch job and wait for completion?
k
Look at Theo’s thread here
k
thx
k
k
i am too, but having issues with the waiter just witing forever
k
Are you using mapped?
k
no idea. doing a very simple flow to figure it out.
this is literally my flow:
Copy code
batch_submit = BatchSubmit()

batch_observer = AWSClientWait(client="batch", waier_name="JobCompleted")

with Flow(FLOW_NAME, storage=STORAGE) as flow:
    hello_world_job = batch_submit.run(
        job_name="prefect-tcf-hello",
        job_definition="tcf-sample",
        job_queue="tcf-tokenization",
        # batch_kwargs=boto_args,
    )

    batch_observer()    

    
flow.register(project_name=PROJECT_NAME)
when I run the flow, it just hangs on the AWSClientWait
there are very few examples
k
You shouldn’t need to call .rrun() for batch_submit. I would try re-registering and re-running without that
k
so something like this then
Copy code
batch_submit = BatchSubmit(
        job_name="prefect-tcf-hello",
        job_definition="tcf-sample",
        job_queue="tcf-tokenization",)

batch_observer = AWSClientWait(client="batch", waiter_name="JobCompleted")

with Flow(FLOW_NAME, storage=STORAGE) as flow:
    hello_world_job = batch_submit()
    batch_observer()    

    
flow.register(project_name=PROJECT_NAME)
k
I haven’t used this myself but shouldn’t you point the Wait to the job somehow?
k
i suspect so. The thread you pointed me to has some hints that may help.