Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eic_container
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
containers
eic_container
Commits
e197430f
Commit
e197430f
authored
1 year ago
by
Wouter Deconinck
Browse files
Options
Downloads
Patches
Plain Diff
feat: remove support for beamline in setup_detectors.py
parent
8453b355
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!622
feat: remove support for beamline in setup_detectors.py
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
containers/jug/setup_detectors.py
+41
-91
41 additions, 91 deletions
containers/jug/setup_detectors.py
with
41 additions
and
91 deletions
containers/jug/setup_detectors.py
+
41
−
91
View file @
e197430f
...
...
@@ -8,33 +8,6 @@ import subprocess
from
datetime
import
datetime
DETECTOR_REPO_GROUP
=
'
https://github.com/eic
'
DETECTOR_BEAMLINE_ENV
=
'''
#!/bin/sh
export DETECTOR={detector}
export DETECTOR_PATH={data_prefix}
export DETECTOR_CONFIG={detector}
export DETECTOR_VERSION={version}
export BEAMLINE_PATH={data_prefix}
export BEAMLINE_CONFIG={ip}
export BEAMLINE_CONFIG_VERSION={ip_version}
## note: we will phase out the JUGGLER_* flavor of variables in the future
export JUGGLER_DETECTOR=$DETECTOR
export JUGGLER_DETECTOR_CONFIG=$DETECTOR_CONFIG
export JUGGLER_DETECTOR_VERSION=$DETECTOR_VERSION
export JUGGLER_DETECTOR_PATH=$DETECTOR_PATH
export JUGGLER_BEAMLINE_CONFIG=$BEAMLINE_CONFIG
export JUGGLER_BEAMLINE_CONFIG_VERSION=$BEAMLINE_CONFIG_VERSION
export JUGGLER_INSTALL_PREFIX=/usr/local
## Export detector libraries
export LD_LIBRARY_PATH={prefix}/lib${{LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}}
## modify PS1 for this detector version
export PS1=
"
${{PS1:-}}
"
export PS1=
"
{branch}${{PS1_SIGIL}}>${{PS1#*>}}
"
unset branch
'''
DETECTOR_ENV
=
'''
#!/bin/sh
export DETECTOR={detector}
...
...
@@ -99,7 +72,7 @@ if __name__ == '__main__':
default_version
=
cfg
[
'
version
'
]
default_found
=
True
print
(
'
- {}: {}{}
'
.
format
(
det
,
branch
,
default_str
))
print
(
'
--> Building and installing detector
/ip
libraries
'
)
print
(
'
--> Building and installing detector libraries
'
)
process_list
=
[]
for
det
in
detectors
:
if
not
args
.
nightly
and
'
nightly
'
in
detectors
[
det
]:
...
...
@@ -109,53 +82,41 @@ if __name__ == '__main__':
version
=
cfg
[
'
version
'
]
if
branch
!=
'
nightly
'
else
'
nightly
'
prefix
=
'
{}/{}-{}
'
.
format
(
args
.
prefix
,
det
,
version
)
data_dir
=
'
{}/share/{}
'
.
format
(
prefix
,
det
)
## build list of projects to install
proj_vers_list
=
[(
det
,
cfg
[
'
version
'
])]
if
'
ip
'
in
cfg
:
ip
=
cfg
[
'
ip
'
]
proj_vers_list
.
append
((
ip
[
'
config
'
],
ip
[
'
version
'
]))
## build and install projects
for
(
proj
,
vers
)
in
proj_vers_list
:
print
(
'
- {}-{}
'
.
format
(
proj
,
vers
))
## clone/build/install detector libraries
cmd
=
[
'
rm -rf /tmp/build /tmp/det
'
,
'
&&
'
,
'
git clone --depth 1 -b {version} {repo_grp}/{detector}.git /tmp/det
'
.
format
(
version
=
vers
,
repo_grp
=
DETECTOR_REPO_GROUP
,
detector
=
proj
),
'
&&
'
,
'
cmake -B /tmp/build -S /tmp/det -DCMAKE_CXX_STANDARD=17
'
,
'
-DCMAKE_CXX_FLAGS=
"
-Wno-psabi
"'
,
'
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
'
,
'
-DCMAKE_INSTALL_PREFIX={prefix}
'
.
format
(
prefix
=
prefix
),
'
&&
'
,
'
cmake --build /tmp/build -j$(($(($(nproc)/4))+1)) -- install
'
]
## build and install
print
(
'
- {}-{}
'
.
format
(
det
,
cfg
[
'
version
'
]))
## clone/build/install detector libraries
cmd
=
[
'
rm -rf /tmp/build /tmp/det
'
,
'
&&
'
,
'
git clone --depth 1 -b {version} {repo_grp}/{detector}.git /tmp/det
'
.
format
(
version
=
cfg
[
'
version
'
],
repo_grp
=
DETECTOR_REPO_GROUP
,
detector
=
det
),
'
&&
'
,
'
cmake -B /tmp/build -S /tmp/det -DCMAKE_CXX_STANDARD=17
'
,
'
-DCMAKE_CXX_FLAGS=
"
-Wno-psabi
"'
,
'
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
'
,
'
-DCMAKE_INSTALL_PREFIX={prefix}
'
.
format
(
prefix
=
prefix
),
'
&&
'
,
'
cmake --build /tmp/build -j$(($(($(nproc)/4))+1)) -- install
'
]
print
(
'
'
.
join
(
cmd
))
subprocess
.
check_call
(
'
'
.
join
(
cmd
),
shell
=
True
)
## write version info to jug_info if available
if
os
.
path
.
exists
(
'
/etc/jug_info
'
):
cmd
=
[
'
cd /tmp/det
'
,
'
&&
'
,
'
echo
"
- {detector}/{branch}: {version}-$(git rev-parse HEAD)
"'
.
format
(
detector
=
det
,
branch
=
branch
,
version
=
cfg
[
'
version
'
]),
'
>> /etc/jug_info
'
,
'
&&
'
,
'
cd -
'
]
print
(
'
'
.
join
(
cmd
))
subprocess
.
check_call
(
'
'
.
join
(
cmd
),
shell
=
True
)
## write version info to jug_info if available
if
os
.
path
.
exists
(
'
/etc/jug_info
'
):
cmd
=
[
'
cd /tmp/det
'
,
'
&&
'
,
'
echo
"
- {detector}/{branch}: {version}-$(git rev-parse HEAD)
"'
.
format
(
detector
=
proj
,
branch
=
branch
,
version
=
cfg
[
'
version
'
]),
'
>> /etc/jug_info
'
,
'
&&
'
,
'
cd -
'
]
print
(
'
'
.
join
(
cmd
))
subprocess
.
check_call
(
'
'
.
join
(
cmd
),
shell
=
True
)
## also copy over IP configuration to the detector
if
'
ip
'
in
cfg
and
os
.
path
.
exists
(
'
/tmp/det/{ip}
'
.
format
(
ip
=
cfg
[
'
ip
'
][
'
config
'
])):
cmd
=
'
cp -r /tmp/det/{ip} {data_dir}
'
.
format
(
ip
=
ip
[
'
config
'
],
data_dir
=
data_dir
)
print
(
cmd
)
subprocess
.
check_call
(
cmd
,
shell
=
True
)
## cleanup
cmd
=
'
rm -rf /tmp/det /tmp/build
'
print
(
cmd
)
subprocess
.
check_call
(
cmd
,
shell
=
True
)
## cleanup
cmd
=
'
rm -rf /tmp/det /tmp/build
'
print
(
cmd
)
subprocess
.
check_call
(
cmd
,
shell
=
True
)
# be resilient against failures
if
os
.
path
.
exists
(
prefix
):
## create a shortcut for the prefix if desired
...
...
@@ -167,24 +128,13 @@ if __name__ == '__main__':
subprocess
.
check_call
(
cmd
,
shell
=
True
)
## write an environment file for this detector
with
open
(
'
{prefix}/setup.sh
'
.
format
(
prefix
=
prefix
),
'
w
'
)
as
f
:
if
'
ip
'
in
cfg
:
print
(
DETECTOR_BEAMLINE_ENV
.
format
(
prefix
=
prefix
,
detector
=
det
,
data_prefix
=
data_dir
,
version
=
cfg
[
'
version
'
],
ip
=
ip
[
'
config
'
],
ip_version
=
ip
[
'
version
'
],
branch
=
branch
),
file
=
f
)
else
:
print
(
DETECTOR_ENV
.
format
(
prefix
=
prefix
,
detector
=
det
,
data_prefix
=
data_dir
,
version
=
cfg
[
'
version
'
],
branch
=
branch
),
file
=
f
)
print
(
DETECTOR_ENV
.
format
(
prefix
=
prefix
,
detector
=
det
,
data_prefix
=
data_dir
,
version
=
cfg
[
'
version
'
],
branch
=
branch
),
file
=
f
)
## run once inside global prefix to initialize artifacts in /opt/detectors
os
.
environ
[
'
DETECTOR_PATH
'
]
=
args
.
prefix
cmd
=
f
'
cd
{
args
.
prefix
}
&& source
{
prefix
}
/setup.sh && checkGeometry -c
{
prefix
}
/share/
{
det
}
/
{
det
}
.xml
'
...
...
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