Skip to content

Web: minor job submission tweaks#6872

Merged
AenBleidd merged 2 commits intomasterfrom
dpa_submit55
Feb 19, 2026
Merged

Web: minor job submission tweaks#6872
AenBleidd merged 2 commits intomasterfrom
dpa_submit55

Conversation

@davidpanderson
Copy link
Contributor

@davidpanderson davidpanderson commented Feb 19, 2026

  • Job instance page: show only relevant fields
  • Job page: show output files size next to download links
  • Batch page: fix PHP warnings
  • antique_file_deleter: code cleanup (no functional change)

Summary by cubic

Improves job and batch pages for clarity, adds output file sizes, and cleans up the antique file deleter. Pages now show only relevant fields and avoid PHP warnings.

  • New Features

    • Show output file sizes next to download links on the job page.
    • Job instance page hides fields until relevant (exit status after completion; run/CPU/credit/validate only on success).
    • Allow aborting batches in INIT state.
  • Bug Fixes & Refactors

    • Fixed PHP warnings on the batch page by initializing job counters.
    • Consolidated output-file path handling for “assim move” apps; get_output3 and the job page now use the shared helper.
    • Cleaned up antique_file_deleter logs and flow; no functional changes.

Written for commit 85e1f8e. Summary will update on new commits.

- Job instance page: show only relevant fields
- Job page: show output files size next to download links
- Batch page: fix PHP warnings
- antique_file_deleter: code cleanup (no functional change)
Copilot AI review requested due to automatic review settings February 19, 2026 00:41
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 5 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="html/user/submit.php">

<violation number="1" location="html/user/submit.php:873">
P2: `filesize($path)` is called without checking that the output file exists, which can trigger PHP warnings when the file is missing. Consider guarding or using a fallback size value.</violation>
</file>

<file name="sched/antique_file_deleter.cpp">

<violation number="1" location="sched/antique_file_deleter.cpp:249">
P2: Returning immediately on any non-zero `wu.enumerate()` result causes antique file cleanup to be skipped when there are no workunits (ERR_DB_NOT_FOUND). The previous logic still deleted files older than the 31‑day cutoff in that case. Consider only aborting on real DB errors and allowing the fallback cutoff when no rows are found.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment on lines +249 to 257
ret = wu.enumerate("where name not like '%nodelete%' order by id limit 1");
if (ret) {
log_messages.printf(MSG_CRITICAL, "No workunits\n");
return ret;
}
max_mod_time = time(0) - 32*86400;
if (max_mod_time > wu.create_time) {
max_mod_time = wu.create_time - 86400;
}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 19, 2026

Choose a reason for hiding this comment

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

P2: Returning immediately on any non-zero wu.enumerate() result causes antique file cleanup to be skipped when there are no workunits (ERR_DB_NOT_FOUND). The previous logic still deleted files older than the 31‑day cutoff in that case. Consider only aborting on real DB errors and allowing the fallback cutoff when no rows are found.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At sched/antique_file_deleter.cpp, line 249:

<comment>Returning immediately on any non-zero `wu.enumerate()` result causes antique file cleanup to be skipped when there are no workunits (ERR_DB_NOT_FOUND). The previous logic still deleted files older than the 31‑day cutoff in that case. Consider only aborting on real DB errors and allowing the fallback cutoff when no rows are found.</comment>

<file context>
@@ -231,13 +241,19 @@ int delete_antiques_from_dir(char*dirpath, time_t mtime, uid_t uid) {
-        t = wu.create_time - 86400;
+    // max_mod_time = min (create_time_of_oldest_wu, 31days_ago)
+
+    ret = wu.enumerate("where name not like '%nodelete%' order by id limit 1");
+    if (ret) {
+        log_messages.printf(MSG_CRITICAL, "No workunits\n");
</file context>
Suggested change
ret = wu.enumerate("where name not like '%nodelete%' order by id limit 1");
if (ret) {
log_messages.printf(MSG_CRITICAL, "No workunits\n");
return ret;
}
max_mod_time = time(0) - 32*86400;
if (max_mod_time > wu.create_time) {
max_mod_time = wu.create_time - 86400;
}
max_mod_time = time(0) - 32*86400;
ret = wu.enumerate("where name not like '%nodelete%' order by id limit 1");
if (ret && ret != ERR_DB_NOT_FOUND) {
log_messages.printf(MSG_CRITICAL,
"Couldn't enumerate workunits: %d\n", ret
);
return ret;
}
if (!ret && max_mod_time > wu.create_time) {
max_mod_time = wu.create_time - 86400;
}
Fix with Cubic

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request makes several minor improvements to the web interface for job submission and a code cleanup to the antique_file_deleter daemon. The changes include displaying only relevant fields on the job instance page based on job state, showing file sizes next to download links, fixing PHP warnings in batch processing, and refactoring the antique_file_deleter code for better readability.

Changes:

  • Job instance page now conditionally displays fields (exit status, run time, CPU time, credit, validate state) based on result state
  • Output file sizes are now shown next to download links for assim_move apps
  • Fixed PHP warnings by initializing batch job counters that could be undefined in early returns
  • Added ability to abort batches in INIT state
  • Refactored antique_file_deleter.cpp for better code structure and readability (with one functional bug fix)

Reviewed changes

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

Show a summary per file
File Description
sched/antique_file_deleter.cpp Refactored if-else chain to separate if statements with early continues; improved error handling for missing workunits; renamed variable for clarity
html/user/submit.php Added BATCH_STATE_INIT to abortable states; added file size display for output files in assim_move apps
html/user/get_output3.php Refactored inline outfile_path function to use shared assim_move_outfile_path function
html/inc/submit_util.inc Added assim_move_outfile_path function; initialized njobs_success and njobs_in_prog to fix PHP warnings; improved comments
html/inc/result.inc Conditionally display result fields based on server state and outcome for better UX

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

// don't show 'view' link if it's a .zip
$y = "$name: ";
$y = sprintf('%s (%s): ',
$name, size_string(filesize($path))
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The filesize() function is called without checking if the file exists first. This can generate PHP warnings if the output file doesn't exist. Consider wrapping the filesize call in a file_exists() check, similar to how the non-assim_move case handles this at lines 900-911. If the file doesn't exist, you could display a message like "file missing" as is done in the else branch.

Copilot uses AI. Check for mistakes.
Comment on lines +249 to +252
ret = wu.enumerate("where name not like '%nodelete%' order by id limit 1");
if (ret) {
log_messages.printf(MSG_CRITICAL, "No workunits\n");
return ret;
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

This changes the behavior when wu.enumerate() returns an error. The original code would continue execution with max_mod_time set to time(0) - 32*86400, while the new code returns early with an error. This is actually a bug fix (the new behavior is better), but contradicts the PR description's claim of "no functional change" for antique_file_deleter. Consider updating the PR description to note this functional improvement.

Copilot uses AI. Check for mistakes.
@AenBleidd AenBleidd merged commit da85ee4 into master Feb 19, 2026
437 of 438 checks passed
@AenBleidd AenBleidd deleted the dpa_submit55 branch February 19, 2026 23:41
@github-project-automation github-project-automation bot moved this from Backlog to Done in Server Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants