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
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
4 years ago
by
Andreas Plach
Browse files
Options
Downloads
Patches
Plain Diff
alp: tools.py - simplified check for active jobs
parent
dd373105
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide 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):
noWAIT
=
99
waittime
=
10
while
noEXEC
>
10
:
# run "ecaccess-job-list | grep EXEC" and split the resulting
# string at the whitespaces and then count the number of
# occurences of EXEC => # of active jobs
ps
=
subprocess
.
Popen
((
'
ecaccess-job-list
'
),
stdout
=
subprocess
.
PIPE
)
try
:
output
=
str
(
subprocess
.
check_output
((
'
grep
'
,
'
EXEC
'
),
stdin
=
ps
.
stdout
)).
split
()
except
subprocess
.
CalledProcessError
:
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
))
while
(
noEXEC
+
noWAIT
)
>
12
:
# do "ecaccess-job-list" and check the numbers of EXEC and
# WAIT => # of active jobs
ps
=
subprocess
.
check_output
((
'
ecaccess-job-list
'
))
noEXEC
=
str
(
ps
).
count
(
'
EXEC
'
)
noWAIT
=
str
(
ps
).
count
(
'
WAIT
'
)
print
(
'
number of EXEC jobs:
'
,
str
(
noEXEC
))
print
(
'
number of WAIT jobs:
'
,
str
(
noWAIT
))
import
time
print
(
'
waiting until less processes are active (checking every
'
+
str
(
waittime
)
+
'
s)
'
)
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