Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flex Extract
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Flexpart
Flex Extract
Commits
3d44ae0d
Commit
3d44ae0d
authored
Oct 19, 2020
by
Andreas Plach
Browse files
Options
Downloads
Patches
Plain Diff
alp: tools.py - simplified check for active jobs
parent
dd373105
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Source/Python/Mods/tools.py
+8
-24
8 additions, 24 deletions
Source/Python/Mods/tools.py
with
8 additions
and
24 deletions
Source/Python/Mods/tools.py
+
8
−
24
View file @
3d44ae0d
...
@@ -727,30 +727,14 @@ def submit_job_to_ecserver(target, jobname):
...
@@ -727,30 +727,14 @@ def submit_job_to_ecserver(target, jobname):
noWAIT
=
99
noWAIT
=
99
waittime
=
10
waittime
=
10
while
noEXEC
>
10
:
while
(
noEXEC
+
noWAIT
)
>
12
:
# run "ecaccess-job-list | grep EXEC" and split the resulting
# do "ecaccess-job-list" and check the numbers of EXEC and
# string at the whitespaces and then count the number of
# WAIT => # of active jobs
# occurences of EXEC => # of active jobs
ps
=
subprocess
.
check_output
((
'
ecaccess-job-list
'
))
ps
=
subprocess
.
Popen
((
'
ecaccess-job-list
'
),
stdout
=
subprocess
.
PIPE
)
noEXEC
=
str
(
ps
).
count
(
'
EXEC
'
)
try
:
noWAIT
=
str
(
ps
).
count
(
'
WAIT
'
)
output
=
str
(
subprocess
.
check_output
((
'
grep
'
,
'
EXEC
'
),
stdin
=
ps
.
stdout
)).
split
()
print
(
'
number of EXEC jobs:
'
,
str
(
noEXEC
))
except
subprocess
.
CalledProcessError
:
print
(
'
number of WAIT jobs:
'
,
str
(
noWAIT
))
break
noEXEC
=
output
.
count
(
'
EXEC
'
)
print
(
'
number of active jobs:
'
,
str
(
noEXEC
))
import
time
print
(
'
waiting until less processes are active (checking every
'
+
str
(
waittime
)
+
'
s)
'
)
time
.
sleep
(
waittime
)
# do the same for waiting jobs
while
noWAIT
>
5
:
ps
=
subprocess
.
Popen
((
'
ecaccess-job-list
'
),
stdout
=
subprocess
.
PIPE
)
try
:
output
=
str
(
subprocess
.
check_output
((
'
grep
'
,
'
WAIT
'
),
stdin
=
ps
.
stdout
)).
split
()
except
subprocess
.
CalledProcessError
:
break
noWAIT
=
output
.
count
(
'
WAIT
'
)
print
(
'
number of waiting jobs:
'
,
str
(
noWAIT
))
import
time
import
time
print
(
'
waiting until less processes are active (checking every
'
+
str
(
waittime
)
+
'
s)
'
)
print
(
'
waiting until less processes are active (checking every
'
+
str
(
waittime
)
+
'
s)
'
)
time
.
sleep
(
waittime
)
time
.
sleep
(
waittime
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment