Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
HTConfig
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
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
EKPCondor
HTConfig
Commits
08dc933f
Commit
08dc933f
authored
9 months ago
by
Sebastian Brommer
Browse files
Options
Downloads
Patches
Plain Diff
update prepare script
parent
f7e0376a
Branches
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
scripts/prepare_singularity.py
+11
-7
11 additions, 7 deletions
scripts/prepare_singularity.py
with
11 additions
and
7 deletions
scripts/prepare_singularity.py
+
11
−
7
View file @
08dc933f
#!/usr/bin/python3
import
os
import
sys
import
json
def
get_job_ad
():
...
...
@@ -16,7 +15,7 @@ def get_job_ad():
if
"
=
"
in
line
:
key
=
line
.
split
(
"
=
"
)[
0
]
value
=
line
.
replace
(
f
"
{
key
}
=
"
,
""
)
job_ad
[
key
.
strip
()
]
=
value
.
strip
(
)
job_ad
[
key
.
strip
()
.
replace
(
'"'
,
""
)]
=
value
.
strip
().
replace
(
'"'
,
""
)
return
job_ad
...
...
@@ -56,10 +55,11 @@ def check_image_availability(image_path):
def
main
():
job_ad
=
get_job_ad
()
status_message
=
""
# write job_ad to a
json
file for debugging
dumpfilepath
=
"
/scratch/job_ad.json
"
# write job_ad to a file for debugging
dumpfilepath
=
"
/scratch/job_ad
_initial
.json
"
with
open
(
dumpfilepath
,
"
w
"
)
as
f
:
json
.
dump
(
job_ad
,
f
,
indent
=
4
)
for
key
,
value
in
job_ad
.
items
():
f
.
write
(
f
"
{
key
}
=
{
value
}
\n
"
)
container_image
=
job_ad
.
get
(
"
ContainerImage
"
)
docker_image
=
job_ad
.
get
(
"
DockerImage
"
)
...
...
@@ -73,8 +73,10 @@ def main():
"
/cvmfs/unpacked.cern.ch/registry.hub.docker.com/mschnepf/slc7-condocker:latest
"
)
job_ad
[
"
WantDocker
"
]
=
"
false
"
dumpfilepath
=
"
/scratch/job_ad_updated.json
"
with
open
(
dumpfilepath
,
"
w
"
)
as
f
:
json
.
dump
(
job_ad
,
f
,
indent
=
4
)
for
key
,
value
in
job_ad
.
items
():
f
.
write
(
f
"
{
key
}
=
{
value
}
\n
"
)
return
# pick the args parameter that is not None
image
=
container_image
or
docker_image
...
...
@@ -90,8 +92,10 @@ def main():
# dump the updated job ad to a file for debugging
job_ad
[
"
ContainerImage
"
]
=
condor_arg
job_ad
[
"
WantDocker
"
]
=
"
false
"
dumpfilepath
=
"
/scratch/job_ad_updated.json
"
with
open
(
dumpfilepath
,
"
w
"
)
as
f
:
json
.
dump
(
job_ad
,
f
,
indent
=
4
)
for
key
,
value
in
job_ad
.
items
():
f
.
write
(
f
"
{
key
}
=
{
value
}
\n
"
)
status_message
=
f
"
Container image
{
image_path
}
is available, using it
"
print
(
f
"
HookStatusMessage =
{
status_message
}
"
)
...
...
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