Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get latest job revision while submitting AWS batch job without specifying the exact revision number

I am using AWSBatch Java client com.amazonaws.services.batch (AWS SDK for Java - 1.11.483) to submit jobs programmatically.

However, our scientists keep updating the job definition. Every time there is a new job definition, I have to update the environment variable with the revision number to pass it to the client. AWS documentation states that

This value can be either a name:revision or the Amazon Resource Name (ARN) for the job definition.

Is there any way I can default it to the latest revision and every time I submit a BatchJob, the latest revision will get picked without even knowing the last revision?

like image 823
IamAshay Avatar asked Jan 29 '19 22:01

IamAshay


People also ask

Why is my AWS batch job stuck in runnable status?

RUNNABLE jobs are started as soon as sufficient resources are available in one of the compute environments that are mapped to the job's queue. If enough resources to run a job aren't available, then the job can remain in RUNNABLE status indefinitely.

What is job definition in AWS batch?

AWS Batch job definitions specify how jobs are to be run. While each job must reference a job definition, many of the parameters that are specified in the job definition can be overridden at runtime. Contents. Creating a single-node job definition. Creating a multi-node parallel job definition.


2 Answers

This value can be either a name:revision or the Amazon Resource Name (ARN) for the job definition.

Seems like AWS didn't document this properly: revision is optional, you can use simply use name instead of name:revision and it will get the ACTIVE revision of your job definition. It's also optional for Job Definition ARNs.

This also applies for boto3 and for AWS Step Functions integration with AWS Batch, and probably all other interfaces where Job Definition name or ARN are required.

like image 152
Ilya Sotkov Avatar answered Nov 12 '22 09:11

Ilya Sotkov


From AWS Batch SubmitJob API reference.

jobDefinition

The job definition used by this job. This value can be one of name, name:revision, or the Amazon Resource Name (ARN) for the job definition. If name is specified without a revision then the latest active revision is used.

perhaps the documentation is updated by now.

like image 22
piyumi_rameshka Avatar answered Nov 12 '22 08:11

piyumi_rameshka