Skip to content

Commit

Permalink
Merge pull request #36 from mrakitin/update-auth.db
Browse files Browse the repository at this point in the history
TST: rename the user in auth.db to "testuser"
  • Loading branch information
jklynch authored Aug 26, 2021
2 parents 6710ff1 + e5860d1 commit 9e00501
Show file tree
Hide file tree
Showing 119 changed files with 50 additions and 17 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name : tests
on:
push:
pull_request:
schedule:
- cron: '00 4 * * *' # daily at 4AM

jobs:
build:
Expand All @@ -22,7 +24,11 @@ jobs:
uses: supercharge/mongodb-github-action@1.6.0

- name: start Sirepo-Bluesky container
run: bash scripts/start_docker.sh -d
run: |
set -vxeuo pipefail
. scripts/start_docker.sh -d
export SIREPO_DOCKER_CONTAINER_ID
echo "SIREPO_DOCKER_CONTAINER_ID=${SIREPO_DOCKER_CONTAINER_ID}" >> $GITHUB_ENV
- name: is Sirepo-Bluesky running?
run: docker ps -a
Expand All @@ -32,11 +38,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

#- name: Add conda to system path
#run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
#echo $CONDA/bin >> $GITHUB_PATH

- name: Create conda environment
run: |
# For reference: https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html.
Expand Down Expand Up @@ -65,4 +66,10 @@ jobs:
set -vxeuo pipefail
source $CONDA/etc/profile.d/conda.sh
conda activate test
pytest -s -v sirepo_bluesky/tests
pytest -s -vv sirepo_bluesky/tests
status=$?
echo "Sirepo Docker container id: ${SIREPO_DOCKER_CONTAINER_ID}"
docker logs ${SIREPO_DOCKER_CONTAINER_ID}
if [ $status -gt 0 ]; then
exit $status
fi
36 changes: 30 additions & 6 deletions scripts/start_docker.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#!/bin/bash

# set -vxeuo pipefail

error_msg="Specify '-it' or '-d' on the command line as a first argument."

if [ -z "$1" ]; then
echo "${error_msg}"
exit 1
elif [ "$1" != "-it" -a "$1" != "-d" ]; then
echo "${error_msg} Specified argument: ${1}"
exit 2
fi

unset cmd _cmd docker_image SIREPO_DOCKER_CONTAINER_ID

month=$(date +"%m")
day=$(date +"%d")
year=$(date +"%Y")
Expand All @@ -8,26 +22,36 @@ today="${HOME}/tmp/data/${year}/${month}/${day}"

docker_image="radiasoft/sirepo:beta"

if [ -d "${today}" ]
then
if [ -d "${today}" ]; then
echo "Directory ${today} exists."
else
echo "Creating Directory ${today}"
mkdir -p "${today}"
fi

ls -l $HOME/tmp
# ls -l $HOME/tmp

docker pull ${docker_image}

docker images

# specify -it or -d on the command line
docker run $1 --init --rm --name sirepo \
in_docker_cmd="mkdir -v -p /sirepo/ && cp -Rv /SIREPO_SRDB_ROOT/* /sirepo/ && sirepo service http"
cmd="docker run $1 --init --rm --name sirepo \
-e SIREPO_AUTH_METHODS=bluesky:guest \
-e SIREPO_AUTH_BLUESKY_SECRET=bluesky \
-e SIREPO_SRDB_ROOT=/sirepo \
-e SIREPO_COOKIE_IS_SECURE=false \
-p 8000:8000 \
-v $PWD/sirepo_bluesky/tests/SIREPO_SRDB_ROOT:/SIREPO_SRDB_ROOT:ro,z \
${docker_image} bash -l -c "mkdir -v -p /sirepo/ && cp -Rv /SIREPO_SRDB_ROOT/* /sirepo/ && sirepo service http"
${docker_image} bash -l -c \"${in_docker_cmd}\""

echo -e "Command to run:\n\n${cmd}\n"
if [ "$1" == "-d" ]; then
SIREPO_DOCKER_CONTAINER_ID=$(eval ${cmd})
export SIREPO_DOCKER_CONTAINER_ID
echo "Container ID: ${SIREPO_DOCKER_CONTAINER_ID}"
docker ps -a
docker logs ${SIREPO_DOCKER_CONTAINER_ID}
else
eval ${cmd}
fi
4 changes: 3 additions & 1 deletion sirepo_bluesky/sirepo_flyer.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ def kickoff(self):
for i in range(len(self.params_to_change)):
# name doesn't need to be unique, server will rename it
c1 = sb.copy_sim('{} Bluesky'.format(sb.data['models']['simulation']['name']), )
print('copy {}, {}'.format(c1.sim_id, c1.data['models']['simulation']['name']))
print('copy {} -> {}, {}'.format(sb.data['models']['simulation']['simulationId'],
c1.sim_id,
c1.data['models']['simulation']['name']))

for key, parameters_to_update in self.params_to_change[i].items():
optic_id = sb.find_optic_id_by_name(key)
Expand Down
Binary file modified sirepo_bluesky/tests/SIREPO_SRDB_ROOT/auth.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"name": "basic (from SRW)",
"notes": "",
"npoint": 100000,
"simulationId": "0jcPUrn9",
"simulationId": "00000001",
"simulationSerial": 1629134267786670,
"sourceType": "geometricSource"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@
"photonEnergy": "4240",
"sampleFactor": 1,
"samplingMethod": 1,
"simulationId": "LFPH22wg",
"simulationId": "00000000",
"simulationSerial": 1629134393894456,
"sourceType": "u",
"verticalPointCount": 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@
"photonEnergy": "9000",
"sampleFactor": 1,
"samplingMethod": 1,
"simulationId": "jUhMGDzv",
"simulationId": "00000001",
"simulationSerial": 1629134295111526,
"sourceType": "g",
"verticalPointCount": 100,
Expand Down

0 comments on commit 9e00501

Please sign in to comment.