Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
iter_name=make_iter_name(ii)
sepline(iter_name,'=')
for jj in range (numb_task) :
if ii * max_tasks + jj <= iter_rec[0] * max_tasks + iter_rec[1] :
continue
task_name="task %02d"%jj
sepline("{} {}".format(iter_name, task_name),'-')
if jj == 0 :
log_iter ("make_train", ii, jj)
make_train (ii, jdata, mdata)
elif jj == 1 :
log_iter ("run_train", ii, jj)
mdata = decide_train_machine(mdata)
run_train (ii, jdata, mdata)
elif jj == 2 :
log_iter ("post_train", ii, jj)
post_train (ii, jdata, mdata)
elif jj == 3 :
log_iter ("make_model_devi", ii, jj)
cont = make_model_devi (ii, jdata, mdata)
if not cont :
break
elif jj == 4 :
log_iter ("run_model_devi", ii, jj)
mdata = decide_model_devi_machine(mdata)
run_model_devi (ii, jdata, mdata)
elif jj == 5 :
log_iter ("post_model_devi", ii, jj)
post_model_devi (ii, jdata, mdata)
elif jj == 6 :
log_iter ("make_fp", ii, jj)
if ii * max_tasks + jj <= iter_rec[0] * max_tasks + iter_rec[1] :
continue
task_name="task %02d"%jj
sepline("{} {}".format(iter_name, task_name),'-')
if jj == 0 :
log_iter ("make_train", ii, jj)
make_train (ii, jdata, mdata)
elif jj == 1 :
log_iter ("run_train", ii, jj)
mdata = decide_train_machine(mdata)
run_train (ii, jdata, mdata)
elif jj == 2 :
log_iter ("post_train", ii, jj)
post_train (ii, jdata, mdata)
elif jj == 3 :
log_iter ("make_model_devi", ii, jj)
cont = make_model_devi (ii, jdata, mdata)
if not cont :
break
elif jj == 4 :
log_iter ("run_model_devi", ii, jj)
mdata = decide_model_devi_machine(mdata)
run_model_devi (ii, jdata, mdata)
elif jj == 5 :
log_iter ("post_model_devi", ii, jj)
post_model_devi (ii, jdata, mdata)
elif jj == 6 :
log_iter ("make_fp", ii, jj)
make_fp (ii, jdata, mdata)
elif jj == 7 :
log_iter ("run_fp", ii, jj)
cont = make_model_devi(ii, jdata, mdata)
if not cont or ii >= jdata.get("stop_iter", ii+1):
break
elif jj == 4:
log_iter("run_model_devi", ii, jj)
mdata = decide_model_devi_machine(mdata)
disp = make_dispatcher(mdata['model_devi_machine'])
run_model_devi(ii, jdata, mdata, disp)
elif jj == 5:
log_iter("post_model_devi", ii, jj)
post_model_devi(ii, jdata, mdata)
elif jj == 6:
log_iter("make_fp", ii, jj)
make_fp(ii, jdata, mdata)
elif jj == 7:
log_iter("run_fp", ii, jj)
if jdata.get("labeled", False):
dlog.info("already have labeled data, skip run_fp")
else:
mdata = decide_fp_machine(mdata)
disp = make_dispatcher(mdata['fp_machine'])
run_fp(ii, jdata, mdata)
elif jj == 8:
log_iter("post_fp", ii, jj)
if jdata.get("labeled", False):
dlog.info("already have labeled data, skip post_fp")
else:
post_fp(ii, jdata)
else:
raise RuntimeError("unknown task %d, something wrong" % jj)
record_iter(record, ii, jj)
jdata['model_devi_jobs'] = [{} for _ in range(ii+1)]
if ii == 0 and jj < 6:
if jj == 0:
log_iter("init_pick", ii, jj)
init_pick(ii, jdata, mdata)
dlog.info("first iter, skip step 1-5")
elif jj == 0:
log_iter("make_train", ii, jj)
make_train(ii, jdata, mdata)
elif jj == 1:
log_iter("run_train", ii, jj)
mdata = decide_train_machine(mdata)
disp = make_dispatcher(mdata['train_machine'])
run_train(ii, jdata, mdata)
elif jj == 2:
log_iter("post_train", ii, jj)
post_train(ii, jdata, mdata)
elif jj == 3:
log_iter("make_model_devi", ii, jj)
cont = make_model_devi(ii, jdata, mdata)
if not cont or ii >= jdata.get("stop_iter", ii+1):
break
elif jj == 4:
log_iter("run_model_devi", ii, jj)
mdata = decide_model_devi_machine(mdata)
disp = make_dispatcher(mdata['model_devi_machine'])
run_model_devi(ii, jdata, mdata, disp)
elif jj == 5:
log_iter("post_model_devi", ii, jj)
post_model_devi(ii, jdata, mdata)
elif jj == 6:
log_iter("make_fp", ii, jj)
ii += 1
iter_name = make_iter_name(ii)
sepline(iter_name, '=')
for jj in range(numb_task):
if ii * max_tasks + jj <= iter_rec[0] * max_tasks + iter_rec[1]:
continue
task_name = "task %02d" % jj
sepline("{} {}".format(iter_name, task_name), '-')
jdata['model_devi_jobs'] = [{} for _ in range(ii+1)]
if ii == 0 and jj < 6:
if jj == 0:
log_iter("init_pick", ii, jj)
init_pick(ii, jdata, mdata)
dlog.info("first iter, skip step 1-5")
elif jj == 0:
log_iter("make_train", ii, jj)
make_train(ii, jdata, mdata)
elif jj == 1:
log_iter("run_train", ii, jj)
mdata = decide_train_machine(mdata)
disp = make_dispatcher(mdata['train_machine'])
run_train(ii, jdata, mdata)
elif jj == 2:
log_iter("post_train", ii, jj)
post_train(ii, jdata, mdata)
elif jj == 3:
log_iter("make_model_devi", ii, jj)
cont = make_model_devi(ii, jdata, mdata)
if not cont or ii >= jdata.get("stop_iter", ii+1):
break
elif jj == 4:
log_iter("run_model_devi", ii, jj)
cont = True
ii = -1
while cont:
ii += 1
iter_name=make_iter_name(ii)
sepline(iter_name,'=')
for jj in range (numb_task) :
if ii * max_tasks + jj <= iter_rec[0] * max_tasks + iter_rec[1] :
continue
task_name="task %02d"%jj
sepline("{} {}".format(iter_name, task_name),'-')
if jj == 0 :
log_iter ("make_train", ii, jj)
make_train (ii, jdata, mdata)
elif jj == 1 :
log_iter ("run_train", ii, jj)
mdata = decide_train_machine(mdata)
run_train (ii, jdata, mdata)
elif jj == 2 :
log_iter ("post_train", ii, jj)
post_train (ii, jdata, mdata)
elif jj == 3 :
log_iter ("make_model_devi", ii, jj)
cont = make_model_devi (ii, jdata, mdata)
if not cont :
break
elif jj == 4 :
log_iter ("run_model_devi", ii, jj)
mdata = decide_model_devi_machine(mdata)
run_model_devi (ii, jdata, mdata)
elif jj == 5 :
make_train(ii, jdata, mdata)
elif jj == 1:
log_iter("run_train", ii, jj)
mdata = decide_train_machine(mdata)
disp = make_dispatcher(mdata['train_machine'])
run_train(ii, jdata, mdata)
elif jj == 2:
log_iter("post_train", ii, jj)
post_train(ii, jdata, mdata)
elif jj == 3:
log_iter("make_model_devi", ii, jj)
cont = make_model_devi(ii, jdata, mdata)
if not cont or ii >= jdata.get("stop_iter", ii+1):
break
elif jj == 4:
log_iter("run_model_devi", ii, jj)
mdata = decide_model_devi_machine(mdata)
disp = make_dispatcher(mdata['model_devi_machine'])
run_model_devi(ii, jdata, mdata, disp)
elif jj == 5:
log_iter("post_model_devi", ii, jj)
post_model_devi(ii, jdata, mdata)
elif jj == 6:
log_iter("make_fp", ii, jj)
make_fp(ii, jdata, mdata)
elif jj == 7:
log_iter("run_fp", ii, jj)
if jdata.get("labeled", False):
dlog.info("already have labeled data, skip run_fp")
else:
mdata = decide_fp_machine(mdata)
disp = make_dispatcher(mdata['fp_machine'])
log_iter ("make_train", ii, jj)
make_train (ii, jdata, mdata)
elif jj == 1 :
log_iter ("run_train", ii, jj)
mdata = decide_train_machine(mdata)
run_train (ii, jdata, mdata)
elif jj == 2 :
log_iter ("post_train", ii, jj)
post_train (ii, jdata, mdata)
elif jj == 3 :
log_iter ("make_model_devi", ii, jj)
cont = make_model_devi (ii, jdata, mdata)
if not cont :
break
elif jj == 4 :
log_iter ("run_model_devi", ii, jj)
mdata = decide_model_devi_machine(mdata)
run_model_devi (ii, jdata, mdata)
elif jj == 5 :
log_iter ("post_model_devi", ii, jj)
post_model_devi (ii, jdata, mdata)
elif jj == 6 :
log_iter ("make_fp", ii, jj)
make_fp (ii, jdata, mdata)
elif jj == 7 :
log_iter ("run_fp", ii, jj)
mdata = decide_fp_machine(mdata)
run_fp (ii, jdata, mdata)
elif jj == 8 :
log_iter ("post_fp", ii, jj)
post_fp (ii, jdata)
log_iter("init_pick", ii, jj)
init_pick(ii, jdata, mdata)
dlog.info("first iter, skip step 1-5")
elif jj == 0:
log_iter("make_train", ii, jj)
make_train(ii, jdata, mdata)
elif jj == 1:
log_iter("run_train", ii, jj)
mdata = decide_train_machine(mdata)
disp = make_dispatcher(mdata['train_machine'])
run_train(ii, jdata, mdata)
elif jj == 2:
log_iter("post_train", ii, jj)
post_train(ii, jdata, mdata)
elif jj == 3:
log_iter("make_model_devi", ii, jj)
cont = make_model_devi(ii, jdata, mdata)
if not cont or ii >= jdata.get("stop_iter", ii+1):
break
elif jj == 4:
log_iter("run_model_devi", ii, jj)
mdata = decide_model_devi_machine(mdata)
disp = make_dispatcher(mdata['model_devi_machine'])
run_model_devi(ii, jdata, mdata, disp)
elif jj == 5:
log_iter("post_model_devi", ii, jj)
post_model_devi(ii, jdata, mdata)
elif jj == 6:
log_iter("make_fp", ii, jj)
make_fp(ii, jdata, mdata)
elif jj == 7:
log_iter("run_fp", ii, jj)