Skip to content

Commit e566abb

Browse files
rahul003jarednielsen
authored andcommitted
Remove unused classes/code (#95)
* Remove unused classes * Remove actions from rule
1 parent f4697ba commit e566abb

File tree

7 files changed

+0
-141
lines changed

7 files changed

+0
-141
lines changed

smdebug/core/actions/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

smdebug/core/actions/action_base.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

smdebug/core/actions/terminate_smjob.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

smdebug/core/sagemaker_utils.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# Standard Library
22
import os
33

4-
# Third Party
5-
import boto3
6-
7-
# First Party
8-
from smdebug.core.config_constants import DEFAULT_SAGEMAKER_OUTDIR
9-
104

115
def is_sagemaker_job():
126
"""
@@ -17,39 +11,3 @@ def is_sagemaker_job():
1711
:return: True or False
1812
"""
1913
return "TRAINING_JOB_NAME" in os.environ
20-
21-
22-
def get_sagemaker_out_dir():
23-
return DEFAULT_SAGEMAKER_OUTDIR
24-
25-
26-
class SageMakerUtils:
27-
@staticmethod
28-
def is_sagemaker_job_finished(jobname, returnMock=None):
29-
if returnMock is not None:
30-
return returnMock
31-
client = boto3.client("sagemaker")
32-
response = client.describe_training_job(TrainingJobName=jobname)
33-
status = response["TrainingJobStatus"]
34-
if status in ["InProgress", "Stopping"]:
35-
return False
36-
elif status in ["Completed", "Failed", "Stopped"]:
37-
return True # return 1 if the job is finished
38-
39-
@staticmethod
40-
def terminate_sagemaker_job(jobname):
41-
client = boto3.client("sagemaker")
42-
try:
43-
client.stop_training_job(TrainingJobName=jobname)
44-
except Exception as e:
45-
print(e)
46-
47-
@staticmethod
48-
def add_tags(sm_job_name, tags):
49-
client = boto3.client("sagemaker")
50-
# TODO create resource arn here
51-
resource_arn = "arn:aws:sagemaker:us-east-1:072677473360:training-job/" + sm_job_name
52-
try:
53-
client.add_tags(ResourceArn=resource_arn, Tags=tags)
54-
except Exception as e:
55-
print(e)

smdebug/rules/rule.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ def __init__(self, base_trial, other_trials=None):
2222

2323
self.req_tensors = RequiredTensors(self.base_trial, self.other_trials)
2424

25-
self.actions = None
2625
self.logger = get_logger()
2726
self.rule_name = self.__class__.__name__
2827

@@ -56,13 +55,4 @@ def invoke(self, step):
5655
val = self.invoke_at_step(step)
5756

5857
if val:
59-
self.run_actions()
6058
raise RuleEvaluationConditionMet(self.rule_name, step)
61-
62-
def register_action(self, actions):
63-
self.actions = actions
64-
65-
def run_actions(self):
66-
if self.actions is not None:
67-
for action in self.actions:
68-
action.run(rule_name=self.__class__.__name__)

smdebug/trials/trial_catalog.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

tests/analysis/trials/test_local.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,11 @@
77

88
# First Party
99
from smdebug.trials import LocalTrial
10-
from smdebug.trials.trial_catalog import LocalTrialCatalog
1110

1211

1312
def check_local(localdir, trial_name, num_steps, num_tensors):
14-
tc = LocalTrialCatalog(localdir=localdir)
15-
assert trial_name in tc.list_candidates()
1613
path = os.path.join(localdir, trial_name)
1714
trial_obj = LocalTrial(name=trial_name, dirname=path)
18-
tc.add_trial(trial_name, trial_obj)
19-
trial_obj2 = tc.get_trial(trial_name)
20-
assert trial_obj == trial_obj2
2115
check_trial(trial_obj, num_tensors=num_tensors, num_steps=num_steps)
2216

2317

0 commit comments

Comments
 (0)