Skip to content

Commit f0745a9

Browse files
committed
adds block args to job batch file
1 parent 5905db2 commit f0745a9

23 files changed

+58
-9
lines changed

.vscode/launch.json

+18
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,24 @@
6666
"console": "integratedTerminal",
6767
"redirectOutput": false
6868
},
69+
{
70+
"name": "jobs/debug.jobs.txt",
71+
"type": "python",
72+
"request": "launch",
73+
"program": "${workspaceFolder}/submit_job.py",
74+
"args": [
75+
"-jf",
76+
"jobs/debug.jobs.txt"
77+
// "studies/reproduction-models/reproducibility-ram.txt",
78+
// "--defaults",
79+
// "-b",
80+
// "5",
81+
// "--job-dir",
82+
// "ajobdir"
83+
],
84+
"console": "integratedTerminal",
85+
"redirectOutput": false
86+
},
6987
{
7088
"name": "studies/debug.batch.txt",
7189
"type": "python",

.vscode/settings.json

+19-1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@
8080
}
8181
]
8282
},
83+
"(#/.*)": {
84+
"filterFileRegex": ".*\\.(batch|jobs).txt",
85+
"decorations": [
86+
{
87+
"color": "#474747",
88+
"textDecoration": "line-through"
89+
}
90+
]
91+
},
8392
"([#;].*)": {
8493
"filterFileRegex": ".*\\.(batch|jobs).txt",
8594
"decorations": [
@@ -88,8 +97,17 @@
8897
}
8998
]
9099
},
100+
"(block):\\s": {
101+
"filterFileRegex": ".*\\.jobs.txt",
102+
"decorations": [
103+
{
104+
"color": "#272822",
105+
"backgroundColor": "#F8F8F2"
106+
}
107+
]
108+
},
91109
"(default:)\\s": {
92-
"filterFileRegex": ".*\\.(batch|jobs).txt",
110+
"filterFileRegex": ".*\\.batch.txt",
93111
"decorations": [
94112
{
95113
"color": "red"

gcp/_config.json

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"jobId": "tdlstm_cc42_restaurants_bal_opts_300hu_run06",
2+
"jobId": "tdlstm_cc42_laptops_bal_001lr_momentum_300hu_run06",
33
"labels": {},
44
"trainingInput": {
55
"scaleTier": "CUSTOM",
@@ -9,15 +9,18 @@
99
"region": "europe-west1",
1010
"args": [
1111
"batch",
12-
"optimizers.batch.txt",
12+
"default.batch.txt",
1313
"--new",
1414
"--nocolor",
1515
"--defaults",
16+
"-mp",
17+
"hidden_units=300",
1618
"-m=td_lstm",
1719
"-em=commoncrawl-42[corpus]",
18-
"-ds=restaurants[33/34/33]",
20+
"-ds=laptops[33/34/33]",
1921
"-mp",
20-
"hidden_units=300"
22+
"optimizer=momentum",
23+
"momentum=0.9"
2124
]
2225
}
2326
}

studies/debug.batch.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ default: -mp hidden_units=5
1818
#default: -rc tf_random_seed=1234
1919
#default: -mp early_stopping_minimum_iter=1 early_stopping_patience=1
2020
#default: -mp oov_train=5 oov_buckets=5 oov_fn=uniform[-0.1,0.1]
21-
#default: -rc save_summary_steps=1 save_checkpoints_steps=2
21+
#/ default: -rc save_summary_steps=1 save_checkpoints_steps=2
2222

File renamed without changes.
File renamed without changes.

submit_job.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,20 @@ def main():
265265
start = int(args.run_start) if args.run_start else 1
266266
jobs_args = []
267267
if args.jobs_file:
268+
block_args = []
268269
for line in open(args.jobs_file, "r"):
269-
comment = line.startswith("#") or line.startswith(";")
270-
if len(line.strip()) > 0 and not comment:
271-
this_args = parser.parse_args(line.split())
270+
if len(line.strip()) == 0:
271+
block_args = []
272+
continue
273+
if line.startswith("#") or line.startswith(";"):
274+
continue
275+
if line.startswith("block"):
276+
block_args += line.strip().split()[1:]
277+
else:
278+
line_cmd = line.split()
279+
if block_args and "--defaults" not in line_cmd:
280+
line_cmd += ["--defaults"]
281+
this_args = parser.parse_args(line_cmd + block_args)
272282
this_nruns = this_args.nruns or nruns
273283
this_start = (
274284
int(this_args.run_start)

0 commit comments

Comments
 (0)