Skip to content

Commit 1316eba

Browse files
committed
feature: simplified job_name creation
1 parent 229784b commit 1316eba

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

src/sagemaker/clarify.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,11 +1025,8 @@ def run_pre_training_bias(
10251025
bias_config,
10261026
methods
10271027
)
1028-
if job_name is None:
1029-
if self.job_name_prefix:
1030-
job_name = utils.name_from_base(self.job_name_prefix)
1031-
else:
1032-
job_name = utils.name_from_base("Clarify-Pretraining-Bias")
1028+
# when name is either not provided (is None) or an empty string ("")
1029+
job_name = job_name or utils.name_from_base(self.job_name_prefix or "Clarify-Pretraining-Bias")
10331030
return self._run(
10341031
data_config,
10351032
analysis_config,
@@ -1111,11 +1108,8 @@ def run_post_training_bias(
11111108
methods,
11121109
model_config
11131110
)
1114-
if job_name is None:
1115-
if self.job_name_prefix:
1116-
job_name = utils.name_from_base(self.job_name_prefix)
1117-
else:
1118-
job_name = utils.name_from_base("Clarify-Posttraining-Bias")
1111+
# when name is either not provided (is None) or an empty string ("")
1112+
job_name = job_name or utils.name_from_base(self.job_name_prefix or "Clarify-Posttraining-Bias")
11191113
return self._run(
11201114
data_config,
11211115
analysis_config,
@@ -1208,11 +1202,8 @@ def run_bias(
12081202
pre_training_methods,
12091203
post_training_methods,
12101204
)
1211-
if job_name is None:
1212-
if self.job_name_prefix:
1213-
job_name = utils.name_from_base(self.job_name_prefix)
1214-
else:
1215-
job_name = utils.name_from_base("Clarify-Bias")
1205+
# when name is either not provided (is None) or an empty string ("")
1206+
job_name = job_name or utils.name_from_base(self.job_name_prefix or "Clarify-Bias")
12161207
return self._run(
12171208
data_config,
12181209
analysis_config,
@@ -1303,11 +1294,8 @@ def run_explainability(
13031294
model_scores,
13041295
explainability_config
13051296
)
1306-
if job_name is None:
1307-
if self.job_name_prefix:
1308-
job_name = utils.name_from_base(self.job_name_prefix)
1309-
else:
1310-
job_name = utils.name_from_base("Clarify-Explainability")
1297+
# when name is either not provided (is None) or an empty string ("")
1298+
job_name = job_name or utils.name_from_base(self.job_name_prefix or "Clarify-Explainability")
13111299
return self._run(
13121300
data_config,
13131301
analysis_config,

0 commit comments

Comments
 (0)