From bf9cf89eda03148ae0f9fd40a8c13bedb6a96f8c Mon Sep 17 00:00:00 2001 From: Zhangqier Date: Wed, 1 Dec 2021 04:27:33 +0100 Subject: [PATCH 1/3] change stepchain timeperevent calculation --- Unified/rejector.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Unified/rejector.py b/Unified/rejector.py index 24d60dd00..dd025f20a 100755 --- a/Unified/rejector.py +++ b/Unified/rejector.py @@ -211,6 +211,16 @@ def rejector(url, specific, options=None): ## transform the schema into StepChain schema print "Transforming a TaskChain into a StepChain" mcore = 0 + ## find maximum mcore + while True: + tt = 'Task%d'% it + it+=1 + if tt in schema: + tmcore = schema[tt].get('Multicore',1) + mcore = max(mcore, tmcore) + if mcore > UC.get("max_nCores_for_stepchain"): + mcore = UC.get("max_nCores_for_stepchain") + mem = 0 schema['RequestType'] = 'StepChain' schema['StepChain'] = schema.pop('TaskChain') @@ -218,6 +228,7 @@ def rejector(url, specific, options=None): schema['TimePerEvent'] = 0 step=1 s_n = {} + it = 1 while True: if 'Task%d'%step in schema: sname = 'Step%d'%step @@ -236,7 +247,6 @@ def rejector(url, specific, options=None): else: wfi.sendLog('rejector','the conversion to stepchain encoutered different value of Multicore %d != %d'%( tmcore, mcore)) sendLog('rejector','the conversion of %s to stepchain encoutered different value of Multicore %d != %d'%( wfo.name, tmcore, mcore)) - mcore = max(mcore, tmcore) mem = max(mem, tmem) schema[sname]['StepName'] = schema[sname].pop('TaskName') s_n[ schema[sname]['StepName'] ] = sname @@ -257,7 +267,8 @@ def rejector(url, specific, options=None): if not 'KeepOutput' in schema[sname]: ## this is a weird translation capability. Absence of keepoutput in step means : keep the output. while in TaskChain absence means : drop schema[sname]['KeepOutput'] = False - schema['TimePerEvent'] += eff*schema[sname].pop('TimePerEvent') + factor = (float(tmcore) / float(mcore)) + schema['TimePerEvent'] += eff*schema[sname].pop('TimePerEvent')*factor schema['SizePerEvent'] += eff*schema[sname].pop('SizePerEvent') step+=1 else: From b6a201ecf51b2de11517d3f5613a35c9c5b373e0 Mon Sep 17 00:00:00 2001 From: Zhangqier Date: Wed, 1 Dec 2021 04:31:32 +0100 Subject: [PATCH 2/3] a little change --- Unified/rejector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Unified/rejector.py b/Unified/rejector.py index dd025f20a..9d815f5cc 100755 --- a/Unified/rejector.py +++ b/Unified/rejector.py @@ -212,6 +212,7 @@ def rejector(url, specific, options=None): print "Transforming a TaskChain into a StepChain" mcore = 0 ## find maximum mcore + it=1 while True: tt = 'Task%d'% it it+=1 @@ -228,7 +229,6 @@ def rejector(url, specific, options=None): schema['TimePerEvent'] = 0 step=1 s_n = {} - it = 1 while True: if 'Task%d'%step in schema: sname = 'Step%d'%step From c19c039bb0ddedef24fd098c81f13224d1e1455a Mon Sep 17 00:00:00 2001 From: haozturk Date: Wed, 1 Dec 2021 11:22:37 +0100 Subject: [PATCH 3/3] Fix the infinite loop bug --- Unified/rejector.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Unified/rejector.py b/Unified/rejector.py index 9d815f5cc..21c60a93c 100755 --- a/Unified/rejector.py +++ b/Unified/rejector.py @@ -219,6 +219,8 @@ def rejector(url, specific, options=None): if tt in schema: tmcore = schema[tt].get('Multicore',1) mcore = max(mcore, tmcore) + else: + break if mcore > UC.get("max_nCores_for_stepchain"): mcore = UC.get("max_nCores_for_stepchain")