Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jdl_creator
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rene Caspart
jdl_creator
Commits
6147b282
Commit
6147b282
authored
7 years ago
by
Matthias Schnepf
Browse files
Options
Downloads
Patches
Plain Diff
add features
parent
0a9d3a72
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
classes/JDLCreator.py
+105
-15
105 additions, 15 deletions
classes/JDLCreator.py
examples/cms_local/create_jdl.py
+1
-0
1 addition, 0 deletions
examples/cms_local/create_jdl.py
with
106 additions
and
15 deletions
classes/JDLCreator.py
+
105
−
15
View file @
6147b282
...
...
@@ -19,10 +19,11 @@ class CloudSite(object):
if
name
==
'
condocker
'
:
self
.
universe
=
'
docker
'
self
.
docker_image
=
'
mschnepf/slc6-condocker
'
self
.
requirements
=
'
(TARGET.CLOUDSITE ==
"
condocker
"
)
'
elif
name
==
'
ekpcloud
'
:
self
.
universe
=
'
vanilla
'
self
.
requirements
=
'
(TARGET.CLOUDSITE ==
"
ekpcloud
"
)
'
elif
name
==
'
docker
'
:
self
.
universe
=
'
docker
'
self
.
docker_image
=
'
mschnepf/slc6-condocker
'
elif
name
==
'
ekpsupermachines
'
:
self
.
universe
=
'
docker
'
...
...
@@ -33,10 +34,6 @@ class CloudSite(object):
self
.
universe
=
'
vanilla
'
self
.
requirements
=
'
(TARGET.CLOUDSITE ==
"
bwforcluster
"
)
'
elif
name
==
'
gridka
'
:
self
.
universe
=
'
vanilla
'
self
.
requirements
=
'
(TARGET.CLOUDSITE ==
"
gridka
"
)
'
elif
name
==
'
oneandone
'
:
self
.
universe
=
'
vanilla
'
self
.
requirements
=
'
(TARGET.CLOUDSITE ==
"
oneandone
"
)
'
...
...
@@ -72,6 +69,9 @@ class JDLCreator(object):
self
.
_output_files
=
[]
self
.
_input_files
=
[]
self
.
_remote_job
=
False
self
.
_cpus
=
1
self
.
_accounting_group
=
""
self
.
_cache_files
=
[]
if
len
(
extra_lines
)
>
0
:
self
.
_extra_lines
=
extra_lines
else
:
...
...
@@ -198,6 +198,39 @@ class JDLCreator(object):
"""
Expected maximum memory (upper limit) in MB
"""
self
.
memory
=
memory_
@property
def
cpus
(
self
):
"""
Get Requested number of cores
"""
return
self
.
_cpu
@cpus.setter
def
cpus
(
self
,
cpus_
):
# type: (int) -> None
"""
Set Requested number of cores
"""
self
.
_cpus
=
cpus_
def
SetCpu
(
self
,
cpus_
):
# type: (int) -> None
"""
Set requested number of cores
"""
self
.
cpus
=
cpus_
@property
def
accounting_group
(
self
):
"""
Get accounting group
"""
return
self
.
_cpu
@accounting_group.setter
def
accounting_group
(
self
,
accounting_group_
):
# type: (int) -> None
"""
Set accounting group
"""
self
.
_accounting_group
=
accounting_group_
def
SetAccounting_group
(
self
,
accounting_group_
):
# type: (int) -> None
"""
Set accounting group
"""
self
.
accounting_group
=
accounting_group_
@property
def
arguments
(
self
):
# type: () -> list
...
...
@@ -253,7 +286,7 @@ class JDLCreator(object):
# type: (str) -> None
if
isinstance
(
file_string
,
list
):
for
line
in
file_string
:
self
.
output_files
=
line
self
.
_
output_files
.
append
(
line
)
elif
isinstance
(
file_string
,
(
str
,
int
,
float
)):
self
.
_output_files
.
append
(
file_string
)
else
:
...
...
@@ -274,16 +307,38 @@ class JDLCreator(object):
# type: (str) -> None
if
isinstance
(
file_string
,
list
):
for
line
in
file_string
:
self
.
_input_files
=
line
elif
isinstance
(
file_string
,
(
str
,
int
,
float
,
unicode
)):
self
.
_input_files
.
append
(
line
)
elif
isinstance
(
file_string
,
(
str
,
unicode
)):
self
.
_input_files
.
append
(
file_string
)
else
:
raise
TypeError
(
'
Out
put file is not a string or a number.
'
)
raise
TypeError
(
'
In
put file is not a string or a number.
'
)
def
SetInputFiles
(
self
,
file_string
):
# type: (str) -> None
self
.
input_files
=
file_string
@property
def
cache_files
(
self
):
# type: () -> str
"""
Files which should be cached with th HTDA caching.
"""
return
'
,
'
.
join
(
self
.
_cache_files
)
@input_files.setter
def
cache_files
(
self
,
file_string
):
# type: (str) -> None
if
isinstance
(
file_string
,
list
):
for
line
in
file_string
:
self
.
_cache_files
.
append
(
line
)
elif
isinstance
(
file_string
,
(
str
,
unicode
)):
self
.
_cache_files
=
file_string
else
:
raise
TypeError
(
'
Cache file is not a string.
'
)
def
SetCacheFiles
(
self
,
file_string
):
# type: (str) -> None
self
.
cache_files
=
file_string
@property
def
remote_job
(
self
):
# type: () -> boolean
...
...
@@ -347,13 +402,36 @@ class JDLCreator(object):
# Input and output files
if
len
(
self
.
_input_files
)
>
0
or
len
(
self
.
_output_files
)
>
0
:
jdl_content
.
append
(
'
should_transfer_files = YES
'
)
if
len
(
self
.
_input_files
)
>
0
:
jdl_content
.
append
(
'
transfer_input_files = %s
'
%
self
.
input_files
)
if
len
(
self
.
_input_files
)
==
1
:
print
(
self
.
_input_files
)
jdl_content
.
append
(
'
transfer_input_files = %s
'
%
self
.
_input_files
[
0
])
if
len
(
self
.
_input_files
)
>
1
:
filelist
=
""
for
line
in
self
.
_input_files
:
filelist
+=
line
filelist
+=
'
,
'
jdl_content
.
append
(
'
transfer_input_files = %s
'
%
filelist
[:
-
2
])
if
len
(
self
.
_output_files
)
>
0
:
jdl_content
.
append
(
'
transfer_output_files = %s
'
%
self
.
output_files
)
jdl_content
.
append
(
'
transfer_output_files = %s
'
%
self
.
_output_files
[
0
])
if
len
(
self
.
_output_files
)
>
1
:
filelist
=
""
for
line
in
self
.
_output_files
:
filelist
+=
line
filelist
+=
'
,
'
jdl_content
.
append
(
'
transfer_output_files = %s
'
%
filelist
[:
-
2
])
else
:
jdl_content
.
append
(
'
transfer_output_files =
""'
)
# Cache files
if
len
(
self
.
_cache_files
)
==
1
:
jdl_content
.
append
(
'
+Input_Files =
"
%s
"'
%
self
.
_cache_files
[
0
])
if
len
(
self
.
_cache_files
)
>
1
:
filelist
=
""
for
line
in
self
.
_cache_files
:
filelist
+=
line
filelist
+=
'
,
'
jdl_content
.
append
(
'
+Input_Files =
"
%s
"'
%
filelist
[:
-
2
])
# add environment variables
jdl_content
.
append
(
'
getenv = True
'
)
...
...
@@ -378,6 +456,18 @@ class JDLCreator(object):
jdl_content
.
append
(
'
RequestMemory = %d
'
%
self
.
_memory
)
else
:
print
(
'
Warning: You did not set the requested memory! Please add
"
.memory = int
"
in MB
'
)
# add cpus, if bigger than 1
if
self
.
_cpus
>
1
:
jdl_content
.
append
(
'
request_cpus = %d
'
%
self
.
_cpus
)
# add accounting group, if set
if
self
.
_accounting_group
is
not
""
:
jdl_content
.
append
(
'
accounting_group = %s
'
%
self
.
_accounting_group
)
else
:
print
(
'
Warning: You did not set the accounting group! Please add
"
.accounting_group = str
"'
)
# add extra lines to JDL
if
len
(
self
.
extra_lines
)
>
0
:
...
...
@@ -415,7 +505,7 @@ class JDLCreator(object):
os
.
chmod
(
'
%s/%s
'
%
(
self
.
job_folder
,
self
.
executable
.
split
(
'
/
'
)[
-
1
]),
stat
.
S_IRWXU
|
stat
.
S_IRWXG
|
stat
.
S_IRWXO
)
# create JDL file
self
.
__JDLFilename
=
'
%s/
JDL_%s
'
%
(
self
.
job_folder
,
str
(
self
.
executable
).
split
(
'
/
'
)[
-
1
].
rsplit
(
'
.
'
)[
0
])
self
.
__JDLFilename
=
'
%s/
%s.jdl
'
%
(
self
.
job_folder
,
str
(
self
.
executable
).
split
(
'
/
'
)[
-
1
].
rsplit
(
'
.
'
)[
0
])
with
open
(
self
.
__JDLFilename
,
'
w
'
)
as
file
:
for
line
in
jdl_content
:
...
...
This diff is collapsed.
Click to expand it.
examples/cms_local/create_jdl.py
+
1
−
0
View file @
6147b282
...
...
@@ -28,6 +28,7 @@ def main():
jobs
.
job_folder
=
"
condor_jobs
"
# set name of the folder, where files and information are stored
jobs
.
WriteJDL
()
# write an JDL file and create folder for log files
jobs
.
Submit
()
if
__name__
==
"
__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