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

Make scheduler jobs configurable #503

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mishaschwartz
Copy link
Collaborator

Overview

The scheduler component automatically enables three jobs (autodeploy, logrotate, notebookdeploy). If someone wants to use the scheduler component but does not want these jobs, there is no obvious way to disable any one of these jobs.

This change makes it possible to enable/disable jobs as required by the user and adds documentation to explain how to do this.

Breaking Change:

  • the three jobs that were automatically enabled previously are now no longer enabled by default.
  • to re-enable these three jobs, source the relevant *.env files at the end of your local environment file
    (see documentation for further details)

What about... ?

  • just schedule these jobs for a non-existant day like February 31st?
    • Answer: This would technically work but is not obvious to the user. It is better to make this explicit.
  • just set the schedule to the '#' string?
    • Answer: This is a hack that would work based on the specific way that the docker-crontab image sets schedules.
      However, this is not obvious to the user and is unreliable since it is not documented.

Changes

Non-breaking changes

Breaking changes

  • See above

Related Issue / Discussion

Additional Information

I would really like to use the scheduler for other things but I do not want to have to enable the autodeploy mechanism.
It seems like the scheduler component was designed with the autodeploy mechanism in mind since that is added by default but it could be much more useful if it was more configurable.

CI Operations

birdhouse_daccs_configs_branch: master
birdhouse_skip_ci: false

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Mar 7, 2025
@crim-jenkins-bot
Copy link
Collaborator

E2E Test Results

DACCS-iac Pipeline Results

Build URL : http://daccs-jenkins.crim.ca:80/job/DACCS-iac-birdhouse/3099/
ResultSUCCESS

BIRDHOUSE_DEPLOY_BRANCH : configurable-crontab
DACCS_IAC_BRANCH : master
DACCS_CONFIGS_BRANCH : master
PAVICS_E2E_WORKFLOW_TESTS_BRANCH :
PAVICS_SDI_BRANCH : master

DESTROY_INFRA_ON_EXIT : true
PAVICS_HOST : https://host-140-91.rdext.crim.ca

PAVICS-e2e-workflow-tests Pipeline Results

Tests URL : http://daccs-jenkins.crim.ca:80/job/PAVICS-e2e-workflow-tests/job/master/68/

NOTEBOOK TEST RESULTS
    
[2025-03-07T18:58:42.884Z] ============================= test session starts ==============================
[2025-03-07T18:58:42.884Z] platform linux -- Python 3.11.10, pytest-8.3.3, pluggy-1.5.0
[2025-03-07T18:58:42.884Z] rootdir: /home/jenkins/agent/workspace/PAVICS-e2e-workflow-tests_master
[2025-03-07T18:58:42.884Z] plugins: anyio-4.6.2.post1, dash-2.18.1, nbval-0.11.0, tornasync-0.6.0.post2, xdist-3.6.1
[2025-03-07T18:58:42.884Z] collected 545 items
[2025-03-07T18:58:42.884Z] 
[2025-03-07T18:58:52.046Z] notebooks-auth/geoserver.ipynb ..................                        [  3%]
[2025-03-07T18:59:42.581Z] notebooks-auth/test_cowbird_jupyter.ipynb ..........                     [  5%]
[2025-03-07T18:59:45.887Z] notebooks-auth/test_thredds.ipynb ...........                            [  7%]
[2025-03-07T19:01:31.186Z] pavics-sdi-master/docs/source/notebooks/CaSR_basic.ipynb ......          [  8%]
[2025-03-07T19:11:41.806Z] pavics-sdi-master/docs/source/notebooks/FAQ_dask_parallel.ipynb ..s..... [  9%]
[2025-03-07T19:12:14.173Z] .                                                                        [  9%]
[2025-03-07T19:12:23.809Z] pavics-sdi-master/docs/source/notebooks/WCS_example.ipynb ......         [ 11%]
[2025-03-07T19:12:30.601Z] pavics-sdi-master/docs/source/notebooks/WFS_example.ipynb .....          [ 11%]
[2025-03-07T19:23:21.717Z] pavics-sdi-master/docs/source/notebooks/climex.ipynb ............        [ 14%]
[2025-03-07T19:23:21.718Z] pavics-sdi-master/docs/source/notebooks/eccc-geoapi-climate-stations.ipynb . [ 14%]
[2025-03-07T19:23:28.783Z] ...............                                                          [ 17%]
[2025-03-07T19:23:36.900Z] pavics-sdi-master/docs/source/notebooks/eccc-geoapi-xclim.ipynb .....    [ 17%]
[2025-03-07T19:24:19.008Z] pavics-sdi-master/docs/source/notebooks/esgf-dap.ipynb .......           [ 19%]
[2025-03-07T19:24:34.520Z] pavics-sdi-master/docs/source/notebooks/forecasts.ipynb ......           [ 20%]
[2025-03-07T19:24:43.142Z] pavics-sdi-master/docs/source/notebooks/opendap.ipynb .......            [ 21%]
[2025-03-07T19:24:48.016Z] pavics-sdi-master/docs/source/notebooks/pavics_thredds.ipynb .....       [ 22%]
[2025-03-07T19:28:12.549Z] pavics-sdi-master/docs/source/notebooks/regridding.ipynb ............... [ 25%]
[2025-03-07T19:29:22.265Z] .............                                                            [ 27%]
[2025-03-07T19:29:25.394Z] pavics-sdi-master/docs/source/notebooks/rendering.ipynb .....            [ 28%]
[2025-03-07T19:29:27.200Z] pavics-sdi-master/docs/source/notebooks/subset-user-input.ipynb ........ [ 30%]
[2025-03-07T19:29:50.181Z] .................                                                        [ 33%]
[2025-03-07T19:29:58.050Z] pavics-sdi-master/docs/source/notebooks/subsetting.ipynb ......          [ 34%]
[2025-03-07T19:29:59.438Z] pavics-sdi-master/docs/source/notebook-components/weaver_example.ipynb . [ 34%]
[2025-03-07T19:30:09.076Z] .........                                                                [ 36%]
[2025-03-07T19:30:20.427Z] finch-master/docs/source/notebooks/dap_subset.ipynb ...........          [ 38%]
[2025-03-07T19:30:29.405Z] finch-master/docs/source/notebooks/finch-usage.ipynb ......              [ 39%]
[2025-03-07T19:30:30.793Z] PAVICS-landing-master/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-1DataAccess.ipynb . [ 39%]
[2025-03-07T19:30:35.836Z] .....                                                                    [ 40%]
[2025-03-07T19:31:43.581Z] PAVICS-landing-master/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-2Subsetting.ipynb . [ 40%]
[2025-03-07T19:32:05.677Z] ............                                                             [ 42%]
[2025-03-07T19:33:01.976Z] PAVICS-landing-master/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-3Climate-Indicators.ipynb . [ 42%]
[2025-03-07T19:33:52.132Z] .....s.                                                                  [ 44%]
[2025-03-07T19:34:00.263Z] PAVICS-landing-master/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-4Ensembles.ipynb . [ 44%]
[2025-03-07T19:34:09.803Z] ..                                                                       [ 44%]
[2025-03-07T19:34:31.751Z] PAVICS-landing-master/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-5Visualization.ipynb . [ 44%]
[2025-03-07T19:35:29.447Z] .........                                                                [ 46%]
[2025-03-07T19:35:51.411Z] PAVICS-landing-master/content/notebooks/climate_indicators/PAVICStutorial_ClimateDataAnalysis-6Regridding_Conversion.ipynb . [ 46%]
[2025-03-07T19:42:27.236Z] ....                                                                     [ 47%]
[2025-03-07T19:42:27.237Z] PAVICS-landing-master/content/notebooks/hydrology/PAVICStutorial_Hydrology-01_Intro.ipynb . [ 47%]
[2025-03-07T19:42:31.710Z] ....                                                                     [ 48%]
[2025-03-07T19:42:35.918Z] PAVICS-landing-master/content/notebooks/hydrology/PAVICStutorial_Hydrology-02_Calibration.ipynb . [ 48%]
[2025-03-07T19:42:45.039Z] .....                                                                    [ 49%]
[2025-03-07T19:42:49.240Z] PAVICS-landing-master/content/notebooks/hydrology/PAVICStutorial_Hydrology-03_Watershed_properties.ipynb . [ 49%]
[2025-03-07T19:43:06.532Z] .............                                                            [ 52%]
[2025-03-07T19:43:11.824Z] PAVICS-landing-master/content/notebooks/hydrology/PAVICStutorial_Hydrology-04_Time_series_analysis.ipynb . [ 52%]
[2025-03-07T19:43:12.865Z] ......                                                                   [ 53%]
[2025-03-07T19:43:27.526Z] raven-main/docs/source/notebooks/Region_selection.ipynb .........        [ 55%]
[2025-03-07T19:43:28.102Z] raven-main/docs/source/notebooks/Subset_climate_data_over_watershed.ipynb . [ 55%]
[2025-03-07T19:43:52.740Z] ......                                                                   [ 56%]
[2025-03-07T19:43:54.645Z] RavenPy-master/docs/notebooks/00_Introduction_to_JupyterLab.ipynb ...... [ 57%]
[2025-03-07T19:43:54.645Z]                                                                          [ 57%]
[2025-03-07T19:43:57.119Z] RavenPy-master/docs/notebooks/01_Getting_watershed_boundaries.ipynb .... [ 58%]
[2025-03-07T19:44:07.128Z] ....                                                                     [ 58%]
[2025-03-07T19:44:13.717Z] RavenPy-master/docs/notebooks/02_Extract_geographical_watershed_properties.ipynb . [ 59%]
[2025-03-07T19:44:19.089Z] .............                                                            [ 61%]
[2025-03-07T19:44:48.202Z] RavenPy-master/docs/notebooks/03_Extracting_forcing_data.ipynb ......... [ 63%]
[2025-03-07T19:46:01.533Z] ..                                                                       [ 63%]
[2025-03-07T19:46:05.418Z] RavenPy-master/docs/notebooks/04_Emulating_hydrological_models.ipynb ... [ 64%]
[2025-03-07T19:46:15.078Z] .................                                                        [ 67%]
[2025-03-07T19:46:21.262Z] RavenPy-master/docs/notebooks/05_Advanced_RavenPy_configuration.ipynb .. [ 67%]
[2025-03-07T19:46:31.170Z] ...........                                                              [ 69%]
[2025-03-07T19:46:42.062Z] RavenPy-master/docs/notebooks/06_Raven_calibration.ipynb ......          [ 70%]
[2025-03-07T19:46:47.365Z] RavenPy-master/docs/notebooks/07_Making_and_using_hotstart_files.ipynb . [ 70%]
[2025-03-07T19:46:52.270Z] .....                                                                    [ 71%]
[2025-03-07T19:46:53.660Z] RavenPy-master/docs/notebooks/08_Getting_and_bias_correcting_CMIP6_data.ipynb . [ 71%]
[2025-03-07T19:54:48.696Z] ................                                                         [ 74%]
[2025-03-07T19:54:53.992Z] RavenPy-master/docs/notebooks/09_Hydrological_impacts_of_climate_change.ipynb . [ 75%]
[2025-03-07T19:55:02.599Z] ....                                                                     [ 75%]
[2025-03-07T19:55:41.213Z] RavenPy-master/docs/notebooks/10_Data_assimilation.ipynb ........        [ 77%]
[2025-03-07T19:56:03.177Z] RavenPy-master/docs/notebooks/11_Climatological_ESP_forecasting.ipynb .. [ 77%]
[2025-03-07T19:56:28.877Z] ......                                                                   [ 78%]
[2025-03-07T19:56:50.867Z] RavenPy-master/docs/notebooks/12_Performing_hindcasting_experiments.ipynb . [ 78%]
[2025-03-07T19:56:59.310Z] .......                                                                  [ 80%]
[2025-03-07T19:57:06.552Z] RavenPy-master/docs/notebooks/Assess_probabilistic_flood_risk.ipynb .... [ 80%]
[2025-03-07T19:57:36.371Z] ....                                                                     [ 81%]
[2025-03-07T19:57:58.341Z] RavenPy-master/docs/notebooks/Comparing_hindcasts_and_ESP_forecasts.ipynb . [ 81%]
[2025-03-07T19:58:15.326Z] .......                                                                  [ 83%]
[2025-03-07T19:58:20.642Z] RavenPy-master/docs/notebooks/Distributed_hydrological_modelling.ipynb . [ 83%]
[2025-03-07T19:58:40.843Z] ......                                                                   [ 84%]
[2025-03-07T19:59:04.215Z] RavenPy-master/docs/notebooks/Hydrological_realtime_forecasting.ipynb .. [ 84%]
[2025-03-07T19:59:13.471Z] ....                                                                     [ 85%]
[2025-03-07T19:59:23.090Z] RavenPy-master/docs/notebooks/Managing_Jupyter_Environments.ipynb ...    [ 86%]
[2025-03-07T19:59:51.803Z] RavenPy-master/docs/notebooks/Perform_Regionalization.ipynb .......      [ 87%]
[2025-03-07T19:59:51.803Z] RavenPy-master/docs/notebooks/Running_HMETS_with_CANOPEX_dataset.ipynb . [ 87%]
[2025-03-07T20:00:11.366Z] .............                                                            [ 89%]
[2025-03-07T20:00:31.606Z] RavenPy-master/docs/notebooks/Sensitivity_analysis.ipynb .....           [ 90%]
[2025-03-07T20:00:38.460Z] RavenPy-master/docs/notebooks/time_series_analysis.ipynb ...........     [ 92%]
[2025-03-07T20:01:00.453Z] RavenPy-master/docs/notebooks/paper/Perform_a_climate_change_impact_study_on_a_watershed.ipynb . [ 93%]
[2025-03-07T20:08:10.476Z] ....................                                                     [ 96%]
[2025-03-07T20:08:12.883Z] notebooks/hummingbird.ipynb ............                                 [ 98%]
[2025-03-07T20:10:37.525Z] notebooks/stress-tests.ipynb ......                                      [100%]
[2025-03-07T20:10:37.525Z] 
[2025-03-07T20:10:37.525Z] =============================== warnings summary ===============================
    
  

@@ -0,0 +1,3 @@
if [ -z "${BIRDHOUSE_SCHEDULER_NOTEBOOKDEPLOY_JOB}${BIRDHOUSE_SCHEDULER_AUTODEPLOY_JOB}${BIRDHOUSE_SCHEDULER_LOGROTATE_JOB}${BIRDHOUSE_AUTODEPLOY_EXTRA_SCHEDULER_JOBS}" ] ; then
log WARN 'The scheduler job has been enabled but no jobs are configured to be run. Please enable some jobs or disable the scheduler'
Copy link
Member

Choose a reason for hiding this comment

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

Maybe use components/scheduler in the message to be explicit about what it referred here, just in case there are other "scheduler" logs happening somewhere else.

Scheduler jobs can be enabled by sourcing specific ``*.env`` files in the ``components/scheduler``
directory. The jobs that come included with the Birdhouse code are as follows:

* Enable automatic deployment:
Copy link
Member

Choose a reason for hiding this comment

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

Spacing for all of these does not seem to render correctly.
Probably needs a newline between the nested lists/code blocks.

I could see an anchor to specific subsections of the doc being useful here, so maybe consider using ^^^ header/separators here as well.

. $COMPOSE_DIR/components/scheduler/logrotate_job.env

* Automatically update tutorial Jupyter notebooks:
* note that this only can be enabled if the ``jupyterhub`` component is also enabled
Copy link
Member

Choose a reason for hiding this comment

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

Should the dependency be applied dynamically when sourcing its env file?

This could be relevant if the sourced env makes use of a jupyterhub-specific config that must be sourced first.

Same concept of the below thredds cases.

Comment on lines +2 to +4
${BIRDHOUSE_SCHEDULER_NOTEBOOKDEPLOY_JOB}
${BIRDHOUSE_SCHEDULER_AUTODEPLOY_JOB}
${BIRDHOUSE_SCHEDULER_LOGROTATE_JOB}
Copy link
Member

Choose a reason for hiding this comment

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

I don't mind this approach particularly, but it seems somewhat a random combination whether specific scheduler config-vars are used vs the BIRDHOUSE_AUTODEPLOY_EXTRA_SCHEDULER_JOBS one.

Should the provided scheduler configs all use explicit variables, and BIRDHOUSE_AUTODEPLOY_EXTRA_SCHEDULER_JOBS would be left empty for users to easily extend with their private configs as they deem fit, without dealing with prepend/append other ones added dynamically?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants