Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable Sirepo port #148

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ on:
push:
pull_request:
workflow_dispatch:
inputs:
deploy:
description: 'Deploy documentation'
type: boolean
required: true
default: false
schedule:
- cron: '00 4 * * *' # daily at 4AM
release:
types: [created]
types: [created, published, released]

jobs:
build_docs:
Expand Down Expand Up @@ -40,9 +48,12 @@ jobs:
uses: supercharge/mongodb-github-action@1.6.0

- name: Start Sirepo Docker container
uses: NSLS-II/start-sirepo-action@v2
uses: mrakitin/start-sirepo-action@add-port-parameter
with:
docker-binary: ${{ env.DOCKER_BINARY }}
sirepo-bluesky-branch: configurable-sirepo-port
sirepo-bluesky-repo: mrakitin/sirepo-bluesky
sirepo-port: 8001

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand Down Expand Up @@ -100,7 +111,7 @@ jobs:

- name: Deploy documentation to nsls-ii.github.io
# if: github.repository_owner == 'NSLS-II' && github.ref_name == 'main'
if: github.event_name == 'release'
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy)
# We pin to the SHA, not the tag, for security reasons.
# https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: PyPI upload

on:
release:
types: [created]
types: [created, published, released]

jobs:
publish_pypi:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ jobs:
uses: supercharge/mongodb-github-action@1.6.0

- name: Start Sirepo Docker container
uses: NSLS-II/start-sirepo-action@v2
uses: mrakitin/start-sirepo-action@add-port-parameter
with:
docker-binary: ${{ env.DOCKER_BINARY }}
sirepo-bluesky-branch: configurable-sirepo-port
sirepo-bluesky-repo: mrakitin/sirepo-bluesky
sirepo-port: 8001

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand Down
2 changes: 1 addition & 1 deletion docs/source/notebooks/madx.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"from sirepo_bluesky.madx_flyer import MADXFlyer\n",
"from sirepo_bluesky.sirepo_ophyd import create_classes\n",
"\n",
"connection = SirepoBluesky(\"http://localhost:8000\")\n",
"connection = SirepoBluesky(\"http://localhost:8001\")\n",
"\n",
"data, schema = connection.auth(\"madx\", \"00000002\")\n",
"classes, objects = create_classes(\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/source/notebooks/shadow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"from sirepo_bluesky.sirepo_bluesky import SirepoBluesky\n",
"from sirepo_bluesky.sirepo_ophyd import BeamStatisticsReport, create_classes\n",
"\n",
"connection = SirepoBluesky(\"http://localhost:8000\")\n",
"connection = SirepoBluesky(\"http://localhost:8001\")\n",
"\n",
"data, schema = connection.auth(\"shadow\", sim_id=\"00000002\")\n",
"classes, objects = create_classes(connection=connection)\n",
Expand Down Expand Up @@ -113,7 +113,7 @@
"from sirepo_bluesky.sirepo_bluesky import SirepoBluesky\n",
"from sirepo_bluesky.sirepo_ophyd import BeamStatisticsReport, create_classes\n",
"\n",
"connection = SirepoBluesky(\"http://localhost:8000\")\n",
"connection = SirepoBluesky(\"http://localhost:8001\")\n",
"\n",
"data, schema = connection.auth(\"shadow\", sim_id=\"00000002\")\n",
"\n",
Expand Down
6 changes: 3 additions & 3 deletions docs/source/notebooks/srw.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"from sirepo_bluesky.sirepo_bluesky import SirepoBluesky\n",
"from sirepo_bluesky.sirepo_ophyd import create_classes\n",
"\n",
"connection = SirepoBluesky(\"http://localhost:8000\")\n",
"connection = SirepoBluesky(\"http://localhost:8001\")\n",
"\n",
"data, schema = connection.auth(\"srw\", sim_id=\"00000002\")\n",
"classes, objects = create_classes(connection=connection)\n",
Expand Down Expand Up @@ -112,7 +112,7 @@
"from sirepo_bluesky.sirepo_bluesky import SirepoBluesky\n",
"from sirepo_bluesky.sirepo_ophyd import create_classes\n",
"\n",
"connection = SirepoBluesky(\"http://localhost:8000\")\n",
"connection = SirepoBluesky(\"http://localhost:8001\")\n",
"\n",
"data, schema = connection.auth(\"srw\", sim_id=\"00000002\")\n",
"classes, objects = create_classes(connection=connection)\n",
Expand Down Expand Up @@ -195,7 +195,7 @@
"from sirepo_bluesky.sirepo_bluesky import SirepoBluesky\n",
"from sirepo_bluesky.sirepo_ophyd import create_classes\n",
"\n",
"connection = SirepoBluesky(\"http://localhost:8000\")\n",
"connection = SirepoBluesky(\"http://localhost:8001\")\n",
"\n",
"data, schema = connection.auth(\"srw\", sim_id=\"00000003\")\n",
"classes, objects = create_classes(\n",
Expand Down
5 changes: 3 additions & 2 deletions scripts/start_sirepo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ SIREPO_SRDB_HOST="${SIREPO_SRDB_HOST:-}"
SIREPO_SRDB_HOST_RO="${SIREPO_SRDB_HOST_RO:-}"
SIREPO_SRDB_GUEST="${SIREPO_SRDB_GUEST:-}"
SIREPO_SRDB_ROOT="${SIREPO_SRDB_ROOT:-'/sirepo'}"
SIREPO_PORT="${SIREPO_PORT:-'8000'}"

unset cmd _cmd docker_image SIREPO_DOCKER_CONTAINER_ID

Expand Down Expand Up @@ -79,8 +80,8 @@ cmd_start="${docker_binary} run ${arg} --init ${remove_container} --name sirepo
-e SIREPO_SRDB_ROOT=${SIREPO_SRDB_ROOT} \
-e SIREPO_COOKIE_IS_SECURE=false \
-e SIREPO_FEATURE_CONFIG_REACT_SIM_TYPES='' \
-p 8000:8000 \
-v $SIREPO_SRDB_HOST_RO:/SIREPO_SRDB_ROOT:ro,z "
-p ${SIREPO_PORT}:8000 \
-v ${SIREPO_SRDB_HOST_RO}:/SIREPO_SRDB_ROOT:ro,z "

cmd_extra=""
if [ ! -z "${SIREPO_SRDB_HOST}" -a ! -z "${SIREPO_SRDB_GUEST}" ]; then
Expand Down
22 changes: 11 additions & 11 deletions sirepo_bluesky/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,76 +67,76 @@ def make_dirs():

@pytest.fixture(scope="function")
def srw_empty_simulation(make_dirs):
connection = SirepoBluesky("http://localhost:8000")
connection = SirepoBluesky("http://localhost:8001")
data, _ = connection.auth("srw", "emptysim")
return connection


@pytest.fixture(scope="function")
def srw_youngs_double_slit_simulation(make_dirs):
connection = SirepoBluesky("http://localhost:8000")
connection = SirepoBluesky("http://localhost:8001")
data, _ = connection.auth("srw", "00000000")
return connection


@pytest.fixture(scope="function")
def srw_basic_simulation(make_dirs):
connection = SirepoBluesky("http://localhost:8000")
connection = SirepoBluesky("http://localhost:8001")
data, _ = connection.auth("srw", "00000001")
return connection


@pytest.fixture(scope="function")
def srw_tes_simulation(make_dirs):
connection = SirepoBluesky("http://localhost:8000")
connection = SirepoBluesky("http://localhost:8001")
data, _ = connection.auth("srw", "00000002")
return connection


@pytest.fixture(scope="function")
def srw_ari_simulation(make_dirs):
connection = SirepoBluesky("http://localhost:8000")
connection = SirepoBluesky("http://localhost:8001")
data, _ = connection.auth("srw", "00000003")
return connection


@pytest.fixture(scope="function")
def srw_chx_simulation(make_dirs):
connection = SirepoBluesky("http://localhost:8000")
connection = SirepoBluesky("http://localhost:8001")
data, _ = connection.auth("srw", "HXV1JQ5c")
return connection


@pytest.fixture(scope="function")
def shadow_basic_simulation(make_dirs):
connection = SirepoBluesky("http://localhost:8000")
connection = SirepoBluesky("http://localhost:8001")
data, _ = connection.auth("shadow", "00000001")
return connection


@pytest.fixture(scope="function")
def shadow_tes_simulation(make_dirs):
connection = SirepoBluesky("http://localhost:8000")
connection = SirepoBluesky("http://localhost:8001")
data, _ = connection.auth("shadow", "00000002")
return connection


@pytest.fixture(scope="function")
def madx_resr_storage_ring_simulation(make_dirs):
connection = SirepoBluesky("http://localhost:8000")
connection = SirepoBluesky("http://localhost:8001")
data, _ = connection.auth("madx", "00000000")
return connection


@pytest.fixture(scope="function")
def madx_bl1_compton_simulation(make_dirs):
connection = SirepoBluesky("http://localhost:8000")
connection = SirepoBluesky("http://localhost:8001")
data, _ = connection.auth("madx", "00000001")
return connection


@pytest.fixture(scope="function")
def madx_bl2_triplet_tdc_simulation(make_dirs):
connection = SirepoBluesky("http://localhost:8000")
connection = SirepoBluesky("http://localhost:8001")
data, _ = connection.auth("madx", "00000002")
return connection
Loading