in src/smexperiments/_environment.py [0:0]
def load(cls, training_job_arn_env=TRAINING_JOB_ARN_ENV, processing_job_config_path=PROCESSING_JOB_CONFIG_PATH):
"""Loads source arn of current job from environment.
Args:
training_job_arn_env (str): The environment key for training job ARN.
processing_job_config_path (str): The processing job config path.
Returns:
TrialComponentEnvironment: Job data loaded from the environment. None if config does not exist.
"""
if training_job_arn_env in os.environ:
environment_type = EnvironmentType.SageMakerTrainingJob
source_arn = os.environ.get(training_job_arn_env)
return TrialComponentEnvironment(environment_type, source_arn)
elif os.path.exists(processing_job_config_path):
environment_type = EnvironmentType.SageMakerProcessingJob
source_arn = json.loads(open(processing_job_config_path).read())["ProcessingJobArn"]
return TrialComponentEnvironment(environment_type, source_arn)
else:
return None