Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
KM3BUU
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
simulation
KM3BUU
Commits
6737f66f
Commit
6737f66f
authored
3 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Fix control for local GiBUU installation
parent
c72101dc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Restructure
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
km3buu/ctrl.py
+5
-7
5 additions, 7 deletions
km3buu/ctrl.py
km3buu/environment.py
+5
-1
5 additions, 1 deletion
km3buu/environment.py
with
10 additions
and
8 deletions
km3buu/ctrl.py
+
5
−
7
View file @
6737f66f
...
...
@@ -15,6 +15,7 @@ __status__ = "Development"
from
shutil
import
copy
import
subprocess
from
spython.main
import
Client
import
os
from
os.path
import
join
,
abspath
,
basename
,
isdir
,
isfile
from
tempfile
import
NamedTemporaryFile
,
TemporaryDirectory
from
thepipe.logger
import
get_logger
...
...
@@ -22,15 +23,10 @@ from thepipe.logger import get_logger
from
.
import
IMAGE_NAME
from
.config
import
Config
from
.jobcard
import
Jobcard
,
read_jobcard
from
.environment
import
is
_singularity_version
_greater
,
MIN_SINGULARITY_VERSION
from
.environment
import
check
_singularity_version
log
=
get_logger
(
basename
(
__file__
))
if
not
is_singularity_version_greater
(
MIN_SINGULARITY_VERSION
):
# pragma: no cover
log
.
error
(
"
Singularity version lower than %s
"
%
MIN_SINGULARITY_VERSION
)
raise
OSError
(
"
Singularity version below %s
"
%
MIN_SINGULARITY_VERSION
)
GIBUU_SHELL
=
"""
#!/bin/bash
...
...
@@ -84,6 +80,7 @@ def run_jobcard(jobcard, outdir, container=False):
with
open
(
jobcard_fpath
,
"
w
"
)
as
f
:
f
.
write
(
str
(
jobcard
))
if
container
:
check_singularity_version
()
log
.
info
(
"
Create temporary file for associated runscript
"
)
script_fpath
=
join
(
input_dir
.
name
,
"
run.sh
"
)
with
open
(
script_fpath
,
"
w
"
)
as
f
:
...
...
@@ -106,6 +103,7 @@ def run_jobcard(jobcard, outdir, container=False):
return
output
[
"
return_code
"
]
else
:
p
=
subprocess
.
Popen
(
[
os
.
environ
[
"
CONTAINER_GIBUU_EXEC
"
],
"
<
"
,
jobcard_fpath
],
"
%s < %s
"
%
(
os
.
environ
[
"
CONTAINER_GIBUU_EXEC
"
],
jobcard_fpath
),
shell
=
True
,
cwd
=
outdir
)
return
p
.
wait
()
This diff is collapsed.
Click to expand it.
km3buu/environment.py
+
5
−
1
View file @
6737f66f
...
...
@@ -25,13 +25,17 @@ log = get_logger(basename(__file__))
MIN_SINGULARITY_VERSION
=
"
3.3
"
def
check_singularity_version
():
# pragma: no cover
if
not
is_singularity_version_greater
(
MIN_SINGULARITY_VERSION
):
log
.
error
(
"
Singularity version lower than %s
"
%
MIN_SINGULARITY_VERSION
)
raise
OSError
(
"
Singularity version below %s
"
%
MIN_SINGULARITY_VERSION
)
def
is_singularity_version_greater
(
min_version
):
# pragma: no cover
singularity_version
=
LooseVersion
(
get_singularity_version
().
split
()[
-
1
])
retval
=
singularity_version
>
LooseVersion
(
MIN_SINGULARITY_VERSION
)
return
retval
def
build_image
(
output_dir
):
if
not
isdir
(
output_dir
):
raise
OSError
(
"
Directory not found!
"
)
...
...
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