Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
common_bench
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIC
benchmarks
common_bench
Commits
fff61868
Commit
fff61868
authored
Aug 25, 2021
by
Whitney Armstrong
Browse files
Options
Downloads
Patches
Plain Diff
deleted: bin/dev-shell
deleted: bin/run_many.py
parent
0b5a7ab0
Branches
Branches containing commit
No related tags found
1 merge request
!27
Remove some old scripts
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/dev-shell
+0
-84
0 additions, 84 deletions
bin/dev-shell
bin/run_many.py
+0
-124
0 additions, 124 deletions
bin/run_many.py
with
0 additions
and
208 deletions
bin/dev-shell
deleted
100755 → 0
+
0
−
84
View file @
0b5a7ab0
#!/bin/bash
## =============================================================================
## Setup (if needed) and start a development shell environment on Linux or MacOS
## =============================================================================
## make sure we launch this script from the project root directory
PROJECT_ROOT
=
"
$(
cd
"
$(
dirname
"
$0
"
)
"
>
/dev/null 2>&1
;
pwd
-P
)
"
/..
pushd
${
PROJECT_ROOT
}
## We do not load the global development environment here, as this script is
## to be executed on a "naked" system outside of any container
## =============================================================================
## Step 1: Parse command line options
## do we want to force-update the container (only affects Linux)
## default: we do not want to do this.
FORCE_UPDATE
=
function
print_the_help
{
echo
"USAGE: ./util/start_dev_shell [-f]"
echo
"OPTIONS:"
echo
" -f,--force Force-update container (Only affects Linux)"
echo
" -h,--help Print this message"
echo
""
echo
" This script will setup and launch a containerized development
environment"
exit
}
while
[
$#
-gt
0
]
do
key
=
"
$1
"
case
$key
in
-f
|
--force
)
FORCE_UPDATE
=
"true"
shift
# past value
;;
-h
|
--help
)
print_the_help
shift
;;
*
)
# unknown option
echo
"unknown option
$1
"
exit
1
;;
esac
done
## get OS type
OS
=
`
uname
-s
`
## =============================================================================
## Step 2: Update container and launch shell
echo
"Launching a containerized development shell"
case
${
OS
}
in
Linux
)
echo
" - Detected OS: Linux"
## Use the same prefix as we use for other local packages
export
PREFIX
=
.local/lib
if
[
!
-f
$PREFIX
/juggler_latest.sif
]
||
[
!
-z
${
FORCE_UPDATE
}
]
;
then
echo
" - Fetching singularity image"
mkdir
-p
$PREFIX
wget https://eicweb.phy.anl.gov/eic/juggler/-/jobs/artifacts/master/raw/build/juggler.sif?job
=
singularity:latest
-O
$PREFIX
/juggler_latest.sif
fi
echo
" - Using singularity to launch shell..."
singularity
exec
$PREFIX
/juggler_latest.sif eic-shell
;;
Darwin
)
echo
" - Detector OS: MacOS"
echo
" - Syncing docker container"
docker pull sly2j/juggler:latest
echo
" - Using docker to launch shell..."
docker run
-v
/Users:/Users
-w
=
$PWD
-i
-t
--rm
sly2j/juggler:latest eic-shell
;;
*
)
echo
"ERROR: dev shell not available for this OS (
${
OS
}
)"
exit
1
esac
## =============================================================================
## Step 3: All done
echo
"Exiting development environment..."
This diff is collapsed.
Click to expand it.
bin/run_many.py
deleted
100755 → 0
+
0
−
124
View file @
0b5a7ab0
#!/usr/bin/env python3
"""
This script will run a CI generator or processing script for multiple configurations.
Author: Sylvester Joosten <sjoosten@anl.gov>
"""
import
os
import
argparse
from
multiprocessing
import
Pool
,
get_context
from
tempfile
import
NamedTemporaryFile
class
InvalidArgumentError
(
Exception
):
pass
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
command
'
,
help
=
"
Script to be launched in parallel
"
)
parser
.
add_argument
(
'
--energy
'
,
'
-e
'
,
dest
=
'
energies
'
,
action
=
'
append
'
,
help
=
'
One or more beam energy pairs (e.g. 10x100)
'
,
required
=
True
)
parser
.
add_argument
(
'
--config
'
,
'
-c
'
,
dest
=
'
configs
'
,
action
=
'
append
'
,
help
=
'
One or more configurations
'
,
required
=
True
)
parser
.
add_argument
(
'
--leading
'
,
dest
=
'
leads
'
,
action
=
'
append
'
,
help
=
'
One or more leading particles(opt.)
'
,
required
=
False
)
parser
.
add_argument
(
'
--decay
'
,
dest
=
'
decays
'
,
action
=
'
append
'
,
help
=
'
One or more decay channels (opt.)
'
,
required
=
False
)
parser
.
add_argument
(
'
--nproc
'
,
dest
=
'
nproc
'
,
default
=
5
,
type
=
int
,
help
=
'
Number of processes to launch in parallel
'
,
required
=
False
)
def
worker
(
command
):
'''
Execute the command in a system call, with the supplied argument string.
'''
## use a temporary file to capture the terminal output, and then
## print the terminal output once the command finishes
with
NamedTemporaryFile
()
as
f
:
cmd
=
[
command
,
'
2>&1 >
'
,
f
.
name
]
cmd
=
'
'
.
join
(
cmd
)
print
(
"
Executing
'
{}
'"
.
format
(
cmd
))
ret
=
os
.
system
(
cmd
)
with
open
(
f
.
name
)
as
log
:
print
(
log
.
read
())
return
ret
if
__name__
==
'
__main__
'
:
args
=
parser
.
parse_args
()
print
(
'
Launching CI script in parallel for multiple settings
'
)
for
e
in
args
.
energies
:
beam_setting
=
e
.
split
(
'
x
'
)
if
not
beam_setting
[
0
].
isnumeric
()
or
not
beam_setting
[
1
].
isnumeric
():
print
(
"
Error: invalid beam energy setting:
"
,
e
)
raise
InvalidArgumentError
if
not
os
.
path
.
exists
(
args
.
command
):
print
(
"
Error: Script not found:
"
,
args
.
command
)
raise
InvalidArgumentError
if
args
.
nproc
<
1
or
args
.
nproc
>
50
:
print
(
"
Error: Invalid process limit (should be 1-50):
"
,
args
.
nproc
)
raise
InvalidArgumentError
print
(
'
- command: {}
'
.
format
(
args
.
command
))
print
(
'
- energies: {}
'
.
format
(
args
.
energies
))
print
(
'
- config: {}
'
.
format
(
args
.
configs
))
print
(
'
- nproc: {}
'
.
format
(
args
.
nproc
))
if
(
args
.
leads
):
print
(
'
- leading: {}
'
.
format
(
args
.
leads
))
if
(
args
.
decays
):
print
(
'
- decay: {}
'
.
format
(
args
.
decays
))
## Expand our command and argument list for all combinatorics
cmds
=
[]
decays
=
args
.
decays
if
args
.
decays
else
[
None
]
leads
=
args
.
leads
if
args
.
leads
else
[
None
]
for
e
in
args
.
energies
:
for
c
in
args
.
configs
:
for
l
in
leads
:
for
d
in
decays
:
beam_setting
=
e
.
split
(
'
x
'
)
cmd
=
[
args
.
command
,
'
--ebeam
'
,
beam_setting
[
0
],
'
--pbeam
'
,
beam_setting
[
1
],
'
--config
'
,
c
]
if
l
is
not
None
:
cmd
+=
[
'
--leading
'
,
l
]
if
d
is
not
None
:
cmd
+=
[
'
--decay
'
,
d
]
cmds
.
append
(
'
'
.
join
(
cmd
))
## create a process pool
## note that I'm using themultiprocessing.get_context function to setup
## a context where subprocesses are created using the new "spawn" process
## which avoids deadlocks that sometimes happen in the default dispatch
with
get_context
(
'
spawn
'
).
Pool
(
processes
=
args
.
nproc
)
as
pool
:
return_values
=
pool
.
map
(
worker
,
cmds
)
## check if we all exited nicely, else exit with status 1
if
not
all
(
ret
==
0
for
ret
in
return_values
):
n_fail
=
sum
([
1
for
ret
in
return_values
if
ret
!=
0
])
print
(
'
ERROR, {} of {} jobs failed
'
.
format
(
n_fail
,
len
(
cmds
)))
print
(
'
Return values:
'
,
[
ret
for
ret
in
return_values
if
ret
!=
0
])
exit
(
1
)
## That's all!
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