Skip to content

Commit 32650ee

Browse files
aws-byeldosnavinsoni
authored andcommitted
feature: simplified job_name creation
1 parent 3b2df62 commit 32650ee

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
@@ -1088,11 +1088,8 @@ def run_pre_training_bias(
10881088
bias_config,
10891089
methods
10901090
)
1091-
if job_name is None:
1092-
if self.job_name_prefix:
1093-
job_name = utils.name_from_base(self.job_name_prefix)
1094-
else:
1095-
job_name = utils.name_from_base("Clarify-Pretraining-Bias")
1091+
# when name is either not provided (is None) or an empty string ("")
1092+
job_name = job_name or utils.name_from_base(self.job_name_prefix or "Clarify-Pretraining-Bias")
10961093
return self._run(
10971094
data_config,
10981095
analysis_config,
@@ -1174,11 +1171,8 @@ def run_post_training_bias(
11741171
methods,
11751172
model_config
11761173
)
1177-
if job_name is None:
1178-
if self.job_name_prefix:
1179-
job_name = utils.name_from_base(self.job_name_prefix)
1180-
else:
1181-
job_name = utils.name_from_base("Clarify-Posttraining-Bias")
1174+
# when name is either not provided (is None) or an empty string ("")
1175+
job_name = job_name or utils.name_from_base(self.job_name_prefix or "Clarify-Posttraining-Bias")
11821176
return self._run(
11831177
data_config,
11841178
analysis_config,
@@ -1271,11 +1265,8 @@ def run_bias(
12711265
pre_training_methods,
12721266
post_training_methods,
12731267
)
1274-
if job_name is None:
1275-
if self.job_name_prefix:
1276-
job_name = utils.name_from_base(self.job_name_prefix)
1277-
else:
1278-
job_name = utils.name_from_base("Clarify-Bias")
1268+
# when name is either not provided (is None) or an empty string ("")
1269+
job_name = job_name or utils.name_from_base(self.job_name_prefix or "Clarify-Bias")
12791270
return self._run(
12801271
data_config,
12811272
analysis_config,
@@ -1366,11 +1357,8 @@ def run_explainability(
13661357
model_scores,
13671358
explainability_config
13681359
)
1369-
if job_name is None:
1370-
if self.job_name_prefix:
1371-
job_name = utils.name_from_base(self.job_name_prefix)
1372-
else:
1373-
job_name = utils.name_from_base("Clarify-Explainability")
1360+
# when name is either not provided (is None) or an empty string ("")
1361+
job_name = job_name or utils.name_from_base(self.job_name_prefix or "Clarify-Explainability")
13741362
return self._run(
13751363
data_config,
13761364
analysis_config,

0 commit comments

Comments
 (0)