Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
oar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Luc Giffon
oar
Commits
817f3d65
Commit
817f3d65
authored
7 years ago
by
Jeremy Auguste
Browse files
Options
Downloads
Patches
Plain Diff
Added a new oargen script
parent
6d46dc05
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
oargen.py
+77
-0
77 additions, 0 deletions
oargen.py
with
77 additions
and
0 deletions
oargen.py
0 → 100755
+
77
−
0
View file @
817f3d65
#!/usr/bin/env python
# coding: utf-8
from
__future__
import
print_function
from
__future__
import
unicode_literals
import
argparse
# import logging
import
subprocess
def
argparser
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
command
'
,
nargs
=
'
?
'
,
help
=
"
Command to use for the job (in passive mode)
"
)
parser
.
add_argument
(
'
argument
'
,
nargs
=
argparse
.
REMAINDER
,
help
=
"
Arguments of the command (in passive mode)
"
)
parser
.
add_argument
(
'
-b
'
,
'
--besteffort
'
,
action
=
"
store_true
"
,
help
=
"
Launch job in besteffort mode
"
)
parser
.
add_argument
(
'
-t
'
,
'
--time
'
,
default
=
12
,
type
=
int
,
help
=
"
Estimated maximum duration of the job (in hours)
"
)
parser
.
add_argument
(
'
-g
'
,
'
--gpu
'
,
action
=
"
store_true
"
,
help
=
"
If True, reserves only cores with GPUs
"
)
parser
.
add_argument
(
'
-c
'
,
'
--core
'
,
default
=
1
,
type
=
int
,
help
=
"
Number of cores to reserve
"
)
parser
.
add_argument
(
'
-H
'
,
'
--host
'
,
help
=
"
Name of the host (SQL LIKE syntax accepted)
"
)
parser
.
add_argument
(
'
-i
'
,
'
--interactive
'
,
action
=
"
store_true
"
,
help
=
"
Launch job in interactive mode
"
)
parser
.
add_argument
(
'
-r
'
,
'
--run
'
,
action
=
"
store_true
"
,
help
=
"
Run the command
"
)
# parser.add_argument('-l', '--logger', default='INFO',
# choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'],
# help="Logging level: DEBUG, INFO (default), WARNING, ERROR")
args
=
parser
.
parse_args
()
# numeric_level = getattr(logging, args.logger.upper(), None)
# if not isinstance(numeric_level, int):
# raise ValueError("Invalid log level: {}".format(args.logger))
# logging.basicConfig(level=numeric_level)
return
args
def
main
():
args
=
argparser
()
command
=
[
"
oarsub
"
]
properties
=
"
-p
\"
"
if
args
.
gpu
:
properties
+=
"
gpu IS NOT NULL
"
else
:
properties
+=
"
gpu IS NULL
"
if
args
.
host
is
not
None
:
properties
+=
"
AND host LIKE
'
{}
'"
.
format
(
args
.
host
)
properties
+=
"
\"
"
command
.
append
(
properties
)
ressources
=
"
-l core={},walltime={}:00:00
"
.
format
(
args
.
core
,
args
.
time
)
command
.
append
(
ressources
)
if
args
.
besteffort
:
command
.
append
(
"
-t besteffort -t idempotent
"
)
if
args
.
interactive
:
command
.
append
(
'
-I
'
)
else
:
job_command
=
[
args
.
command
]
+
args
.
argument
command
.
append
(
'"
{}
"'
.
format
(
"
"
.
join
(
job_command
)))
print
(
"
"
.
join
(
command
))
if
args
.
run
:
subprocess
.
call
(
command
)
if
__name__
==
'
__main__
'
:
main
()
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