big fixes:

script_assimilator:
    in error case, pass WU name, ID, and batch ID
    if verbose, show script cmdline
sample_assimilate.py:
    write to ../sample_results/x
    use batch ID in error case
    show cmdlines if os.system() fails
This commit is contained in:
David Anderson 2024-01-16 17:12:12 -08:00
parent 4539eef345
commit 066afd447a
4 changed files with 21 additions and 11 deletions

View File

@ -407,7 +407,7 @@ function handle_query_batch($user) {
page_head("Batch $batch_id");
start_table();
row2("name", $batch->name);
row2("application", $app->name);
row2("application", $app?$app->name:'---');
row2("state", batch_state_string($batch->state));
//row2("# jobs", $batch->njobs);
//row2("# error jobs", $batch->nerror_jobs);

View File

@ -53,6 +53,8 @@
#include "validator.h"
#include "sched_config.h"
#include "assimilate_handler.h"
using std::vector;
using std::string;
@ -118,10 +120,11 @@ int assimilate_handler(
}
}
} else {
sprintf(cmd, "../bin/%s --error %d %lu",
script[0].c_str(), wu.error_mask, wu.id
sprintf(cmd, "../bin/%s --error %d %s %lu %d",
script[0].c_str(), wu.error_mask, wu.name, wu.id, wu.batch
);
}
log_messages.printf(MSG_DEBUG, "invoking script: %s\n", cmd);
retval = system(cmd);
if (retval) return retval;
return 0;

2
tools/demo_submit_batch Normal file → Executable file
View File

@ -65,7 +65,7 @@ def main(argv):
# mark the batch as in progress
cmd = ['bin/create_work', '--enable', str(batch_id)]
cmd = ['bin/create_batch', '--enable', str(batch_id)]
ret = subprocess.run(cmd, capture_output=True)
if ret.returncode:
raise Exception('enable batch failed (%d): %s'%(ret.returncode, ret.stdout))

View File

@ -16,15 +16,22 @@ import sys, os
if sys.argv[1] == '--error':
error_code = sys.argv[2]
wu_name = sys.argv[3]
batch_id = sys.argv[4]
outdir = 'sample_results/%s'%(batch_id)
os.system('mkdir -p %s'%(outdir))
with f as open('%s/errors'%(outdir), 'a'):
wu_id = sys.argv[3]
batch_id = sys.argv[5]
outdir = '../sample_results/%s'%(batch_id)
cmd = 'mkdir -p %s'%(outdir)
if os.system(cmd):
raise Exception('%s failed'%(cmd))
with open('%s/errors'%(outdir), 'a') as f:
f.write('%s %s\n'%(wu_name, error_code))
else:
batch_id = sys.argv[1]
outfile_path = sys.argv[2]
fname = os.path.basename(outfile_path)
outdir = 'sample_results/%s'%(batch_id)
os.system('mkdir -p %s'%(outdir))
os.system('mv %s %s/%s'%(outfile_path, outdir, fname))
outdir = '../sample_results/%s'%(batch_id)
cmd = 'mkdir -p %s'%(outdir)
if os.system(cmd):
raise Exception('%s failed'%(cmd))
cmd = 'mv %s %s/%s'%(outfile_path, outdir, fname)
if os.system(cmd):
raise Exception('%s failed'%(cmd))