tokoi
tokoi

Reputation: 113

How can I get current job-name in SageMaker training job script?

I write some training job on AWS-SageMaker framework.

For some it's requirements, it needs know the job-name of which current running on.

I know this code works for it ...

import sagemaker_containers
env = sagemaker_containers.training_env()
job_name = env['job_name']

But sagemaker_containers package has been deprecated. (I read that on it's GitHub)

What should i do?

I just started learning about this platform last month. I would appreciate any advice. Thank you.

Upvotes: 0

Views: 1923

Answers (1)

ajaykarpur
ajaykarpur

Reputation: 318

For older containers using the deprecated sagemaker_containers, the approach you described is correct.

For newer containers that use sagemaker-training-toolkit, this is how you retrieve information about the environment: https://github.com/aws/sagemaker-training-toolkit#get-information-about-the-container-environment

from sagemaker_training import environment

env = environment.Environment()

job_name = env["job_name"]

You can check the DLC Release Notes to see what's installed in each version.

Upvotes: 4

Related Questions