Get total number of array workers inside of array job

0

If I subsmit a Batch array job, what is the best practice for getting the total number of array workers within each array worker itself?

I can access the worker index using the AWS_BATCH_JOB_ARRAY_INDEX environment variable, but often this number doesn't mean anything (e.g., for determining the extent of a chunk of data for the worker) without the context of the total number of workers.

I understand that I can supply the total array size as a command line argument to the job, but this is cumbersome. Is there a better way?

已提問 2 年前檢視次數 279 次
1 個回答
1

Unfortunately, there is no straight-forward way to access the Batch array length using the Environment variables. The list of environment variables provided in the doc - https://docs.aws.amazon.com/batch/latest/userguide/job_env_vars.html are the only ones available at the moment.

Please feel free to create a feature request for your use-case in the containers-roadmap github project using this link.

profile pictureAWS
支援工程師
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南