Skip to content

Feat/rts python launcher example - #6

Open
msweier wants to merge 8 commits into
mainfrom
feat/rts_python_launcher_example
Open

msweier wants to merge 8 commits into
mainfrom
feat/rts_python_launcher_example

Conversation

@msweier

@msweier msweier commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

I updated this python script launcher example to renew and pass the RTS CDA token, pass some RTS env variables (current watershed, active run, forecast window etc...), and stream stout and staderr to output window. A bit of a hack but might work until cpython is more integrated into RTS.

EDIT: AI assisted

@jbatterman jbatterman left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to seeing how this fits in with our workflow!

@msweier
msweier requested a review from jbatterman November 17, 2026 12:09
@msweier

msweier commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator Author

Ok I updated this to include the main cpython/jython bridge script that can be referenced from RTS or DSS view with jython launcher scripts by using the PYTHON_CWMS_HOME env variable that is created with the pythonCWMS portable installer.

It finds the bridge script at %PYTHON_CWMS_HOME%/jython_scripts which is installed with pythonCWMS. It's recommended that RTS python scripts be stored in <watershed>\scripts\python and the jython launcher scripts be stored in the regular <watershed>\scripts directory.

The jython launcher examples that call the cpython bridge script include one that will launch a GUI to select one of multiple python scripts, an RTS example that will directly call one python script, and an HEC-DSS VUE jython launcher example.

There are 3 options for passing on CDA credentials to python:

  1. CDA_NONE - No CDA variables supplied by the launcher
  2. CDA_ENDPOINT - CDA_API_ROOT and OFFICE are passed from the active RTS CDA connection
  3. CDA_AUTH - Endpoint and office plus CDA_ACCESS_TOKEN, CDA_REFRESH_TOKEN, CDA_TOKEN_URL, and CDA_CLIENT_ID are passed from the active RTS CDA connection. There should be a 10 minute timeout for the token from CDA, so the script is expected to finish within 10 minutes.

There is also an option to pass jython context to the python script at the time of launch including:

Context Environment variables
Watershed RTS_WATERSHED_NAME, RTS_WATERSHED_DIRECTORY, RTS_WATERSHED_TIME_ZONE
Module RTS_CURRENT_MODULE
Forecast RTS_ACTIVE_FORECAST, RTS_ACTIVE_FORECAST_DIRECTORY, RTS_ACTIVE_FORECAST_DSS
Run RTS_ACTIVE_RUN, RTS_ACTIVE_RUN_KEY
Selected model alternative RTS_SELECTED_MODEL_ALTERNATIVE, RTS_SELECTED_MODEL_ALTERNATIVE_PROGRAM, RTS_SELECTED_MODEL_ALTERNATIVE_F_PART
Time window RTS_START_TIME, RTS_EXTRACT_START_TIME, RTS_FORECAST_TIME, RTS_END_TIME

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants