Repository navigation
Conversation
The 13 call_*.sh wrappers must source u19_pipeline/cron_env.sh and leave picking the Python environment to it. Runs each wrapper against stub conda, uv, git and python: by default (or U19_CRON_ENV=conda) it does what it did on master; with U19_CRON_ENV=uv it syncs the checkout's .venv after the pull and runs the .venv python; an unknown value, a missing uv or .venv, or a failed sync stops it before any script runs. Refs #206 Assisted-by: ClaudeCode:claude-opus-5-5
Every call_*.sh now sources u19_pipeline/cron_env.sh, which sources u19prod's .bashrc and .bash_profile, picks the environment and cds into the checkout. The wrapper keeps its own git pull (if it had one) and runs its scripts with u19_cron_python. - U19_CRON_ENV unset, empty or "conda" (default): conda activate U19-pipeline_python_env3 and python, the same commands as before. - U19_CRON_ENV=uv: after the wrapper's pull, uv sync --locked --extra pipeline --no-dev (once per wrapper), then .venv/bin/python with .venv/bin first on PATH. A failed sync, a missing uv or .venv, or an unknown value stops the wrapper before any script runs. cron_uv_env.md says how to build .venv once on u19proc and switch each crontab line; the switch stays off until the new u19proc VM (#54). Refs #206 Assisted-by: ClaudeCode:claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Refs #206. The issue stays open after this merges: it is done when the switch is turned on on u19proc, which is blocked on the new VM (#54).
What it does
All 13
call_*.shcron wrappers now source one shared script,u19_pipeline/cron_env.sh. It sources u19prod's~/.bashrcand~/.bash_profile, picks the Python environment fromU19_CRON_ENV, andcds into the checkout. Each wrapper keeps only its owngit pullline (if it had one) and itsu19_cron_python <script>lines.U19_CRON_ENVconda(default)conda activate U19-pipeline_python_env3andpython <script>: the same commands, in the same order and from the same directories, as on masteruvuv sync --locked --extra pipeline --no-dev(once per wrapper), then.venv/bin/python <script>with.venv/binfirst on PATHWith
uv, a failed sync exits 1 before any script runs, and a missinguv(exit 127) or missing.venv(exit 1, prints the build command) stops the wrapper before it pulls. The wrappers don't build.venvthemselves. That's a one-time manual step, so a missing env shows up in the cron log instead of a multi-GB download inside a cron job.Merging changes nothing in production. Nobody sets
U19_CRON_ENVon u19proc today, so every wrapper stays on conda.Turn on:
U19_CRON_ENV=uv source …/call_x.shon a crontab line (inside the quotes underflock -c), orexport U19_CRON_ENV=uvin u19prod's~/.bash_profilefor all of them. Turn off: delete that prefix or line.u19_pipeline/automatic_job/cron_uv_env.mdcovers the checks to run first (glibc, uv on cron's PATH) and the one-time.venvbuild.crontab_exampleshows both forms.Choices
dj_local_conf.jsonkey (unlikespock_ephys_env). The switch has to be read before any Python runs, and you can set it per crontab line, which is the rollout the issue asks for (one alert first, then the handler).--extra pipeline --no-dev). All wrappers share one.venv, anduv syncis exact, so a wrapper syncing other extras would remove packages the next one needs. The union of what the 13 scripts import is the base deps pluspipeline: the handler, the pupillometry handlers andpopulate_missing_syncbehavior_ephys.pyimport element-array-ephys, element-calcium-imaging, element-interface, paramiko, scp, psutil and bitstring.requestsandmatplotlibcome in through the base deps (blosc2 and datajoint). The pupillometry handler importsdeeplabcutonly inside the function that runs on spock.pipelinebrings the CUDA build of torch (several GB), which u19proc doesn't need at import time (suite2p is imported lazily). A smaller install is possible later with--no-install-package, but this PR doesn't try it..venvmatches theuv.lockthat was just pulled..venv/.lockduring a sync. Two concurrentuv syncruns on spock (uv 0.13.0) showed the second oneWaiting to acquire exclusive lock for .venv at .venv/.lock. uv doesn't wait for scripts already running from.venv, so a pull that changesuv.lockcan replace packages under a running script. That is written down in the doc and not handled further..venv/bingoes first on PATH, because the job handler startsnohup python scp_transfers.py …itself (u19_pipeline/utils/scp_transfers.py).cron_env.shruns at the sourced file's top level, not in a function, so.bashrc,.bash_profileandconda activaterun in the same scope as before. The crontabsources the wrappers from cron's/bin/sh(bash in POSIX mode), and the tests run them that way as well as withbash <wrapper>.U19_CRON_HOME/U19_CRON_REPOreplace the u19prod home and checkout paths for the tests. They default to the production paths.Found on the way
call_cronjob_old_log_deletion.shrunscronjob_olg_log_deletion.py("olg"), but the file iscronjob_old_log_deletion.py. It has been that way since the wrapper was added. I kept the command as it is: fixing it would start old-log deletion on u19proc at merge time. It needs its own issue.manylinux_2_28), so RHEL/Rocky 8 or newer. This is in the doc.Tests
tests/test_cron_env.py, committed before the implementation:call_*.shsourcescron_env.sh, and none activates conda, sources rc files,cds, or runspython/.venvitself.cron_env.shis the onlyconda activateinu19_pipeline/**/*.sh. The list of wrappers must match the table in the test.conda,uv,gitandpythonon a PATH that holds nothing else, and fake home/checkout dirs. Covered cases: default / empty /condagive the same commands as master;uvsyncs then runs the.venvpython; the switch works from the crontab line and from the profile; an unknown value, a failed sync, a missing uv and a missing.venveach stop the wrapper before any script runs; exit statuses pass through; tech_alert syncs once and, under conda, runs all three scripts even if one fails.Runs on spock (CPU slurm jobs):
/home/u19prod…/.bashrc.Not run: anything on u19proc, a real
uv sync --extra pipelineof this checkout, or the real scripts from uv.