Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pbsutils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
toolbox
pbsutils
Commits
becb4344
Commit
becb4344
authored
8 years ago
by
David Verelst
Browse files
Options
Downloads
Patches
Plain Diff
only filter pbslist when building, add option to set cron update interval
parent
ed1280c1
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
launch.py
+24
-14
24 additions, 14 deletions
launch.py
with
24 additions
and
14 deletions
launch.py
+
24
−
14
View file @
becb4344
...
...
@@ -96,7 +96,7 @@ def write_qsub_exe(fname, pbs, tsleep=0.25):
return
job_id
def
write_crontab
():
def
write_crontab
(
every_min
=
5
):
"""
Create a crontab script, and submit to crontab.
"""
python
=
'
/usr/bin/python
'
...
...
@@ -106,9 +106,9 @@ def write_crontab():
fpath
=
os
.
path
.
join
(
cwd
,
'
launch_crontab.sh
'
)
# TODO: parse other relevant arguments as well: --re
# when using the crontab option, cpu parameters are read from the config
# file if it exists
rpl
=
(
cwd
,
python
,
launch
)
crontab
=
'
*/
5
* * * * cd
"
%s
"
; %s %s --crontab ;
\n
'
%
rpl
# file if it exists
, but only the first run will build a pbslist file
rpl
=
(
every_min
,
cwd
,
python
,
launch
)
crontab
=
'
*/
%i
* * * * cd
"
%s
"
; %s %s --crontab
--cache
;
\n
'
%
rpl
f
=
open
(
fpath
,
'
w
'
)
f
.
write
(
crontab
)
f
.
flush
()
...
...
@@ -453,7 +453,7 @@ class Scheduler:
else
:
self
.
print_config
()
print
'
method ; scheduler
'
pbsflist
=
self
.
filter_joblist
(
self
.
get_joblist
()
)
pbsflist
=
self
.
get_joblist
()
self
.
print_logheader
()
self
.
launch
(
pbsflist
,
crontab_mode
=
crontab_mode
)
print
''
...
...
@@ -469,7 +469,9 @@ class Scheduler:
if
verbose
:
print
'
Building file list of to be launched jobs.
'
,
print
'
Might take a while...
'
pbsflist
=
build_pbsflist
(
self
.
path_pbs_files
)
# only filter when building the file list. It would be counter
# intuitive to filter a user generated/controlled list.
pbsflist
=
self
.
filter_joblist
(
build_pbsflist
(
self
.
path_pbs_files
))
if
self
.
sort
:
pbsflist
.
sort
()
save_pbsflist
(
self
.
f_pbsflist
,
pbsflist
)
...
...
@@ -477,8 +479,6 @@ class Scheduler:
if
verbose
:
print
'
Loading file list from cache...
'
pbsflist
=
load_pbsflist
(
self
.
f_pbsflist
)
if
self
.
sort
:
pbsflist
.
sort
()
return
pbsflist
def
filter_joblist
(
self
,
pbsflist
):
...
...
@@ -533,7 +533,7 @@ class Scheduler:
f
.
write
(
'
tsleep_short : % 5.02f
\n
'
%
self
.
tsleep_short
)
f
.
write
(
'
pbs_update_deltat : % 5.02f
\n
'
%
self
.
pbs_update_deltat
)
f
.
write
(
'
reload_pbsflist : % 5i
\n
'
%
self
.
reload_pbsflist
)
f
.
write
(
'
fname
pbsflist : %s
\n
'
%
self
.
f_pbsflist
)
f
.
write
(
'
f_
pbsflist : %s
\n
'
%
self
.
f_pbsflist
)
f
.
flush
()
f
.
close
()
...
...
@@ -880,13 +880,23 @@ if __name__ == '__main__':
parser
.
add_argument
(
'
--sort
'
,
action
=
'
store_true
'
,
dest
=
'
sort
'
,
default
=
False
,
help
=
'
Sort pbs file list. Default=False
'
)
parser
.
add_argument
(
'
--crontab
'
,
action
=
'
store_true
'
,
dest
=
'
crontab
'
,
default
=
False
,
help
=
'
Crontab mode. Implies --cache,
'
'
and not compatible with --node. When all jobs are
'
'
done, crontab -r will remove all the user
\'
s current
'
'
crontab jobs. Default=False
'
)
default
=
False
,
help
=
'
Crontab mode: %prog will check
'
'
every 5 (default) minutes if more jobs can be launched.
'
'
Not compatible with --node. When all jobs are done,
'
'
crontab -r will remove all existing crontab jobs of
'
'
the current user. Use crontab -l to inspect current
'
'
crontab jobs, and edit them with crontab -e.
'
'
Default=False
'
)
parser
.
add_argument
(
'
--every_min
'
,
action
=
'
store
'
,
dest
=
'
every_min
'
,
type
=
'
int
'
,
default
=
5
,
help
=
'
Crontab update interval
'
'
in minutes. Default=5
'
)
parser
.
add_argument
(
'
--debug
'
,
action
=
'
store_true
'
,
dest
=
'
debug
'
,
default
=
False
,
help
=
'
Debug print statements. Default=False
'
)
(
options
,
args
)
=
parser
.
parse_args
()
if
options
.
crontab
and
options
.
node
:
parser
.
print_usage
()
sys
.
stderr
.
write
(
"
error: --node and --crontab not compatible
"
+
os
.
linesep
)
sys
.
exit
(
1
)
if
options
.
nr_cpus
is
None
and
not
options
.
crontab
:
parser
.
print_usage
()
sys
.
stderr
.
write
(
"
error: specify number of cpus with -n
"
+
os
.
linesep
)
...
...
@@ -959,7 +969,7 @@ if __name__ == '__main__':
debug
=
options
.
debug
,
cpu_user_queue
=
options
.
cpu_user_queue
)
if
options
.
crontab
:
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
os
.
getcwd
(),
'
launch_crontab.sh
'
)):
write_crontab
()
write_crontab
(
every_min
=
options
.
every_min
)
if
os
.
path
.
exists
(
ss
.
fname_config
):
ss
.
read_config
()
else
:
...
...
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