Skip to content

feat(flux): support omit_in_job attribute on submit args to drop args invalid inside a job - #5020

Open
jasonb5 wants to merge 2 commits into
masterfrom
feat/omit-in-job-submit-arg
Open

feat(flux): support omit_in_job attribute on submit args to drop args invalid inside a job#5020
jasonb5 wants to merge 2 commits into
masterfrom
feat/omit-in-job-submit-arg

Conversation

@jasonb5

@jasonb5 jasonb5 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds an omit_in_job boolean attribute to <arg> and <argument> submit args in config_batch.xsd; args marked omit_in_job="true" are dropped when submission happens from inside an already-running batch job.
  • Adds EnvBatch.is_in_batch_job(), detecting in-job context via a small static scheduler→env-var mapping (FLUX_JOB_ID, SLURM_JOB_ID, PBS_JOBID, LSB_JOBID, COBALT_JOBID). Only the current batch system's env var is considered.
  • Motivation: on Tuolumne, flux gives each job an ephemeral nested instance with no partitions, so a stale -p <partition> fails on in-job resubmit. The mechanism is generic/attribute-driven so other args can opt in without code changes.

Testing

  • New pytest unit tests in CIME/tests/test_unit_xml_env_batch.py covering in-job, not-in-job, other-scheduler env var present (ignored), and unknown batch system cases; full file passes (29 tests).

Follow-up

  • E3SM model config: add omit_in_job="true" to -p for Tuolumne's flux config_batch.xml.
  • End-to-end validation on Tuolumne with RESUBMIT>=1.

Closes #5018

jasonb5 added 2 commits July 28, 2026 14:52
…id inside a job

Schedulers like flux give each job an ephemeral nested instance where
some submit args (e.g. -p <partition>) are invalid, so args marked
omit_in_job="true" are dropped when submission happens from inside an
already-running batch job, detected via well-known scheduler
environment variables.

Closes #5018
@jasonb5 jasonb5 changed the title feat: support omit_in_job attribute on submit args to drop args invalid inside a job feat(flux): support omit_in_job attribute on submit args to drop args invalid inside a job Jul 28, 2026
@jasonb5

jasonb5 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

Needs testing on actual machine still.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an omit_in_job attribute for batch submit arguments so args that are only valid when submitting outside an existing batch job can be automatically dropped when submissions occur from inside a running job (e.g., Flux nested instances where stale partition args like -p <partition> fail). It extends EnvBatch with an in-job detection helper based on scheduler-specific environment variables and adds unit tests for the new behavior.

Changes:

  • Add omit_in_job (xs:boolean) to <arg> and <argument> submit args in config_batch.xsd.
  • Add EnvBatch.is_in_batch_job() and apply omit_in_job filtering while resolving submit args.
  • Add pytest unit tests covering omit/not-omit behavior based on in-job environment context.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
CIME/XML/env_batch.py Adds in-job detection and omits submit args marked omit_in_job when running inside a batch job.
CIME/tests/test_unit_xml_env_batch.py Adds unit tests for omit_in_job behavior and unknown scheduler handling.
CIME/data/config/xml_schemas/config_batch.xsd Extends schema to allow omit_in_job attribute on submit argument elements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CIME/XML/env_batch.py
Comment on lines +31 to +41
IN_JOB_ENVIRONMENT_VARIABLES = {
"flux": "FLUX_JOB_ID",
"lsf": "LSB_JOBID",
"pbs": "PBS_JOBID",
"pbspro": "PBS_JOBID",
"moab": "PBS_JOBID",
"slurm": "SLURM_JOB_ID",
"slurm_single_node": "SLURM_JOB_ID",
"cobalt": "COBALT_JOBID",
"cobalt_theta": "COBALT_JOBID",
}
Comment on lines +1395 to +1405
def test_is_in_batch_job_unknown_batch_system(monkeypatch):
# Context
batch = EnvBatch()

batch._batchtype = "made_up_scheduler"

monkeypatch.setenv("SLURM_JOB_ID", "1234")

# Act/Assert
assert not batch.is_in_batch_job()

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.

feat(flux): support omit_in_job attribute on submit_args to drop args invalid when submitting from inside a job

2 participants