File tree Expand file tree Collapse file tree 4 files changed +26
-30
lines changed Expand file tree Collapse file tree 4 files changed +26
-30
lines changed Original file line number Diff line number Diff line change @@ -112,23 +112,10 @@ log
112
112
113
113
.DS_Store
114
114
.idea /
115
- * .json
116
- cm.json
117
- cm.ts
118
- collections.json
119
- worker * .json
120
115
121
116
# Wheel and tar files from running `python bin/build_containers.py`
122
117
* .whl
123
118
bin /sagemaker-containers /** /* .tar.gz
124
119
125
- # outdirs
126
- data /
127
- default /
128
- newlogsRunTest * /
129
- MNIST-data /
130
- logs /
131
- savedParams /
132
- ts_outputs * /
133
- test_output * /
120
+ # TODO: Figure out what is generating this and move it to /tmp/MNIST-data
134
121
MNIST-data /
Original file line number Diff line number Diff line change 5
5
check_logs () {
6
6
if grep -e " AssertionError" $1 ;
7
7
then
8
- echo " Integration tests:FAILED."
8
+ echo " Integration tests: FAILED."
9
9
exit 1
10
10
else
11
11
echo " Integration tests: SUCCESS."
@@ -43,3 +43,9 @@ if [ "$run_pytest_pytorch" = "enable" ] ; then
43
43
fi
44
44
45
45
check_logs $REPORT_DIR /*
46
+
47
+ # Only look at newly added files
48
+ if [ -n " $( git status --porcelain | grep ^?? | grep -v tornasolecodebuildtest | grep -v upload) " ]; then
49
+ echo " ERROR: Test artifacts were created. Please place these in /tmp."
50
+ exit 1
51
+ fi
Original file line number Diff line number Diff line change 1
1
# Standard Library
2
2
import os
3
3
import uuid
4
+ from tempfile import TemporaryDirectory
4
5
5
6
# First Party
6
7
import smdebug .pytorch as smd
@@ -97,18 +98,19 @@ def test_s3_path_that_exists_without_end_of_job():
97
98
98
99
99
100
def test_outdir_sagemaker (monkeypatch ):
100
- json_file_contents = """
101
- {
102
- "S3OutputPath": "s3://sagemaker-test",
103
- "LocalPath": "/my/own/path/tensors",
104
- "HookParameters" : {
105
- "save_interval": "2",
106
- "include_workers": "all"
107
- }
108
- }
109
- """
110
- from smdebug .tensorflow import get_hook
111
-
112
- with SagemakerSimulator (json_file_contents = json_file_contents ) as sim :
113
- hook = get_hook ("keras" , create_if_not_exists = True )
114
- assert hook .out_dir == "/my/own/path/tensors"
101
+ with TemporaryDirectory () as dir_name :
102
+ json_file_contents = f"""
103
+ {{
104
+ "S3OutputPath": "s3://sagemaker-test",
105
+ "LocalPath": "{ dir_name } ",
106
+ "HookParameters" : {{
107
+ "save_interval": "2",
108
+ "include_workers": "all"
109
+ }}
110
+ }}
111
+ """
112
+ from smdebug .tensorflow import get_hook
113
+
114
+ with SagemakerSimulator (json_file_contents = json_file_contents ) as sim :
115
+ hook = get_hook ("keras" , create_if_not_exists = True )
116
+ assert hook .out_dir == dir_name
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ def test_hook_all_zero(hook=None, out_dir=None):
22
22
run_id = "trial_" + datetime .now ().strftime ("%Y%m%d-%H%M%S%f" )
23
23
out_dir = "/tmp/newlogsRunTest/" + run_id
24
24
print ("Registering the hook with out_dir {0}" .format (out_dir ))
25
+ shutil .rmtree (out_dir , ignore_errors = True )
25
26
hook = t_hook (
26
27
out_dir = out_dir ,
27
28
save_config = save_config ,
You can’t perform that action at this time.
0 commit comments