On Mon, Apr 19, 2021 at 09:22:11PM +0800, Xu Xijian wrote:
On Mon, Apr 19, 2021 at 08:39:10PM +0800, Li Yuanchao wrote:
If nr_run is a integer and nr_run > 1, submit nr_run times. Else, submit once.
[usage] submit xxx xxx nr_run=3 xxx.yaml
Signed-off-by: Li Yuanchao lyc163mail@163.com
sbin/submit | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/sbin/submit b/sbin/submit index edb207cc0..2e6ad8960 100755 --- a/sbin/submit +++ b/sbin/submit @@ -195,16 +195,21 @@ ARGV.each do |jobfile| scheduler_client = SchedulerClient.new(job['SCHED_HOST'], job['SCHED_PORT'])
# submit job
- job_json = job_hash.to_json
- messages = scheduler_client.submit_job(job_json)
- JSON.parse(messages).each do |msg|
if msg['message'].empty?
result_roots << msg['result_root']
job_ids << msg['job_id'].to_s
puts("submit #{jobfile}, got job id=#{msg['job_id']}")
else
opt_monitor = false
puts("submit #{jobfile} failed, got job id=#{msg['job_id']}, error: #{msg['message']}")
- nr_run = job_hash['nr_run'] || 1
- nr_run = nr_run.to_i
- nr_run = 1 if nr_run < 1
- nr_run.times do
job_json = job_hash.to_json
This line only need to exec once if every time use the same job_json, so put it before "nr_run.times do" line.
ok
Thanks, Yuanchao