https://prefect.io logo
l

Lee Mendelowitz

12/03/2020, 10:33 PM
Hey Community - are there any examples out there for how to use the AWSClientWaitTask? (https://docs.prefect.io/api/latest/tasks/aws.html#awsclientwait). Specifically I’m trying to wait on an AWS Batch job to finish. It’s not clear to me how to pass the job name or job id into the task. Thanks!
d

Dylan

12/03/2020, 10:40 PM
Hey @Lee Mendelowitz! I think that might get passed to the
waiter_definition
but I’m unsure. Curious to see what others in the community think
l

Lee Mendelowitz

12/03/2020, 10:55 PM
Figured it out! It’s through
waiter_kwargs
:
Copy code
from prefect.tasks.aws.client_waiter import AWSClientWait
batch_waiter = AWSClientWait(client = 'batch', waiter_name = 'JobComplete')
batch_waiter.run(waiter_kwargs = {'jobs' : ["<jobId>"]})
It seems that the
waiter_kwargs
maps to the arguments for the
boto3
batch client call to `describe_jobs`:
Copy code
import boto3
client = boto3.client('batch')
res = client.describe_jobs(jobs = ["<jobId"])
d

Dylan

12/03/2020, 10:58 PM
Nice!
3 Views