in runtool/runtool/experiments_converter.py [0:0]
def generate_job_name(self, run: int) -> str:
"""
Generates a training job name for a sagemaker job.
There is a hierarchy of how a job should be named where any expression
provided within the `job.job_name_expression` has highest priority.
Thereafter if a `$job_name` key exists in `job.experiment["algorithm"]`
or in `job.experiment["dataset"]` its value will be used.
If no custom name has been provided, a default training job name is
generated.
"""
# user naming convention has highest priority
if self.job_name_expression:
return apply_trial(
node={"$eval": self.job_name_expression},
locals=DotDict(
dict(
__trial__=self.experiment,
run=run,
run_configuration=self.run_configuration,
)
),
)
# thereafter any jobnames added within the config has prio
if "$job_name" in self.experiment["algorithm"]:
return self.experiment["algorithm"]["$job_name"]
# job names in the dataset has lower priority
if "$job_name" in self.experiment["dataset"]:
return self.experiment["dataset"]["$job_name"]
# fallback on default naming
return (
f"config-{reproducible_hash(self.experiment)}"
f"-date-{self.creation_time}"
f"-runid-{reproducible_hash(self.run_configuration)}"
f"-run-{run}"
)