aws step function invoke with token functionality for invoking aws personalize batch segment job

0

We want to trigger the aws personalize item attribute affinity user segment batch job from our application. We are planning to use step function to trigger the batch segment. The batch segment job is asynchronous job, the job might take more time to complete. Can we use step functions invoke with "Wait for a Callback with the Task Token" functionality to trigger batch segment job ? So that we don't need to implement the wait/sleep and awage/check loop.

Or is there any other way to check the job status without being in a wait-sleep cycle ?

1 Answer
0
Accepted Answer

Not sure what exactly you are asking. If the API you are calling is synchronous, i.e., it blocks until the operation is done and when it returns, you get the answer, there is nothing special you need to do.

If however, the operation is asynchronous, i.e., you get a job ID, you will need to poll for the response by getting into a look that gets the status of the job, checks for completion, and if it did not complete yet, wait a few seconds/minutes and go back.

Specifically with Personalize, if you refer to the create_batch_segment_job, it is asynchrouns, you will need to call describe_batch_segment_job in a loop to get the latest status.

There are a few services that have optimized integrations with Step Functions. With these services you can call the API using .sync in the resource name, and Step Functions will do the loop for you. Personalize is not one of these services.

You also mentioned a token. I am not sure exactly to which token you are refering to. If you are refering to the Wait for task token integration type, you will need someone to call the completion API, and Personalize does't know how to do it.

profile pictureAWS
EXPERT
Uri
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions