Skip to content

Feat: Output retrieval for HTCondor - #37

Draft
Alexander-Auer wants to merge 108 commits into
DIRACGrid:mainfrom
Alexander-Auer:stack/htcondor-5-output
Draft

Alexander-Auer wants to merge 108 commits into
DIRACGrid:mainfrom
Alexander-Auer:stack/htcondor-5-output

Conversation

@Alexander-Auer

Copy link
Copy Markdown
Contributor

feat: collect output from the HTCondor-CE backend

Part of #23. PR 5 of 6 for the HTCondor-CE backend.

Important

Depends on #36 (stack/htcondor-4-kill-purge). Merge after it.
Until then, this diff also shows the earlier PRs. This PR's own change: 525 lines

get_output runs condor_transfer_data into the private working area, then moves the files to dest/<CE host>/<job id>. Collecting again replaces the earlier copy.

Decisions to check

  • Output is repeatable until purge. [Feature]: HTCondorCEBackend — grid CE over the shared _htcondor core #23 asks to evaluate leave_in_queue as the override for one-shot retrieval and to record the decision. This is that decision: a lost download is not lost output. The cost is that finished jobs stay queued until the consumer purges them.
  • The CE cannot choose where this host writes. SUBMIT_Iwd comes from the remote job ad, so it must be inside our working area, or nothing is transferred.
  • Limits: links are refused, and max_output_files, max_output_bytes and transfer_timeout_s apply. Exceeding one fails that job only.
  • Per-job outcomes: an active job is refused, a failed job can still be collected, and a job that has left the queue reports its output as gone.
  • Concurrency: up to 4 transfers at once. Two collections of one job take turns, using a lock that only exists while in use, so the backend keeps no record of jobs.

Testing

23 new unit tests, including a CE returning a directory outside the working area, a link in the output, and two collections of one job at once. Tests against a real CE arrive in PR 6.

Alexander-Auer and others added 30 commits October 2, 2026 16:54
* feat: Models the core contract needs

* Feat: Protocols and Exceptions added for the core contract

* Feat: Private protocols for the BatchBackend

* feat: a fake backend to run unit tests against

* fix: some code cleanup in the helper functions

* feat: setup for the unit test suite

* chore: style fix

* chore: styling, unit test fixture

* chore: single letter var `h` refering to hanlde changed to `handle`

* fix: unused parameter in `test_injected_failure_is_reported_per_job()` removed

* feat: Models the core contract needs

* Feat: Protocols and Exceptions added for the core contract

* Feat: Private protocols for the BatchBackend

* feat: a fake backend to run unit tests against

* fix: some code cleanup in the helper functions

* feat: setup for the unit test suite

* chore: style fix

* chore: styling, unit test fixture

* chore: single letter var `h` refering to hanlde changed to `handle`

* fix: unused parameter in `test_injected_failure_is_reported_per_job()` removed

* fix: made the OutputSpec optional as it is not suppoerted by all and a consumer should choose to use it or not

---------

Co-authored-by: alexander <alexander.auer@cern.ch>
The contract says inputs are read before submit returns, so an unreadable
one is a SpecificationRejectedError, not a raw OSError. The conformance suite
now asks for it, and the fake does it.

Part of DIRACGrid#23.
- process: runs one tool, killing it on a timeout
- session: one operation's credentials in private files that exist only
  while it runs, the tools' environment, and telling a rejected token from
  an unreachable CE
- staging: the private working area, and what a submission puts in it

Nothing uses these yet. The backend follows in the next commit.

Part of DIRACGrid#23.
Spooled submission to a remote schedd, token authentication, and an optional
X.509 proxy for sites that account on VOMS attributes. Copies whose variable
names differ get separate clusters, because HTCondor merges each process's
environment onto the previous one.

Registered as `htcondor-ce`. Kill, purge and output follow in their own
branches.

Part of DIRACGrid#23.
FakeCondor answers the way HTCondor 25 does (checked against a live schedd),
so these run without HTCondor installed: credentials, error classification,
staging, secrets, containers and the working area.

Part of DIRACGrid#23.
The credential provider now returns one credential instead of a set, and proxies
are gone: no proxy file, and no delegation setting to go with it. The kind is
checked once, where the token comes from, so the rest only deals with a token.

X509_CERT_DIR stays. It holds the CAs the CE's host certificate is checked against,
which has nothing to do with a proxy.
Kill only removes active jobs, because removing a finished one would release
output that has not been collected. That is what purge is for. A job removed
a moment ago is still queued but already released, so purging twice is
harmless. Token scopes follow the operation: compute.cancel here.

Part of DIRACGrid#23.
Whether a purged job's status is then UNKNOWN or a final state depends on
whether the resource still remembers it: a schedd's history does, an in-memory
fake does not. Both are within the contract.

Part of DIRACGrid#23.
condor_transfer_data into the private working area, then moved into dest.
The job ad comes from the remote side, so the CE can never choose where this
host writes: links are refused and the output limits apply. Two collections
of one job take turns, and the backend remembers nothing about jobs afterwards.

Part of DIRACGrid#23.
…e any job is submitted

A line break in an argument or variable raised a raw ValueError, after the
clusters before it were already submitted: those jobs stayed queued without a
handle. Every description is now written first, and such a value is a
SpecificationRejectedError.
The core is tested through the HTCondor-CE backend that uses it, and on the
htcondor stack by the shared suite.
…show

Normal submit and status are the shared suite's, on the htcondor stack. One
file stays, through the backend's public operations: the states a stack never
reaches, refusals, partial submissions, secrets and the token, resources, and
the answers of a CE that refuses or cannot be read.
…ill-purge

# Conflicts:
#	tests/unit/backends/htcondorce/test_process.py
#	tests/unit/backends/htcondorce/test_status.py
Killing and purging are the shared suite's, on the htcondor stack.
# Conflicts:
#	tests/unit/backends/htcondorce/test_cleanup.py
#	tests/unit/backends/htcondorce/test_working_area.py
…cannot show

Collecting output is the shared suite's, on the htcondor stack. What stays: a
CE that points outside the working area or sends links, the limits, transfers
that fail or bring nothing, and one job collected twice at once.
backend.py only builds the parts and checks that the backend is open.
Submitting is in submit.py; what every operation shares (which handles
are ours, the CE's job ads, the sessions, status) is in jobs.py.
backend.py only builds the parts and checks that the backend is open.
Submitting is in submit.py, kill and purge in cancel.py; what every
operation shares (which handles are ours, the CE's job ads, the
sessions, status) is in jobs.py.
…ill-purge

# Conflicts:
#	src/intercede/_backends/monolith/htcondorce/__init__.py
#	src/intercede/_backends/monolith/htcondorce/backend.py
#	src/intercede/_backends/monolith/htcondorce/jobs.py
backend.py only builds the parts and checks that the backend is open.
Submitting is in submit.py, output in output.py, kill and purge in
cancel.py; what every operation shares (which handles are ours, the
CE's job ads, the sessions, status) is in jobs.py.
# Conflicts:
#	src/intercede/_backends/monolith/htcondorce/__init__.py
#	src/intercede/_backends/monolith/htcondorce/backend.py

This branch has not been deployed

No deployments
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.

1 participant