Skip to content

fix bug in python assimilator handler#6879

Merged
AenBleidd merged 2 commits intomasterfrom
dpa_assim2
Feb 21, 2026
Merged

fix bug in python assimilator handler#6879
AenBleidd merged 2 commits intomasterfrom
dpa_assim2

Conversation

@davidpanderson
Copy link
Contributor

@davidpanderson davidpanderson commented Feb 21, 2026

check for existence of output file


Summary by cubic

Handle missing output files in the Python assimilator handler by checking existence before moving. Missing files are logged to stderr and skipped to prevent crashes.

  • Bug Fixes
    • Added os.path.exists check around the move in tools/sample_assimilate.py; writes "file not found" to stderr and continues.

Written for commit 0e05f01. Summary will update on new commits.

Copilot AI review requested due to automatic review settings February 21, 2026 09:14
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.

No issues found across 1 file

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 PR fixes a bug in the Python assimilator handler by adding a file existence check before processing output files. Without this check, the script would fail when attempting to process non-existent files through the is_gzip() function (which calls os.path.getsize()) or the mv command.

Changes:

  • Added file existence validation before processing each output file
  • Added error message printing and graceful skip for missing files using continue

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

for i in range(nfiles):
outfile_path = sys.argv[2*i+3]
if not os.path.exists(outfile_path):
print('file not found: ', outfile_path)
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

The print statement with a comma separator will add an extra space between the colon and the filepath. Consider using string formatting (e.g., f'file not found: {outfile_path}' or 'file not found: {}'.format(outfile_path)) to avoid the double space in the output.

Suggested change
print('file not found: ', outfile_path)
print(f'file not found: {outfile_path}')

Copilot uses AI. Check for mistakes.
for i in range(nfiles):
outfile_path = sys.argv[2*i+3]
if not os.path.exists(outfile_path):
print('file not found: ', outfile_path)
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

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

Error messages should be written to stderr for consistency. Line 65 in this same file uses sys.stderr.write() for error reporting. Using print() sends the message to stdout instead of stderr, which is inconsistent with error reporting conventions and could interfere with normal output parsing.

Suggested change
print('file not found: ', outfile_path)
sys.stderr.write('file not found: %s\n' % (outfile_path,))

Copilot uses AI. Check for mistakes.
@AenBleidd AenBleidd added this to Server Feb 21, 2026
@github-project-automation github-project-automation bot moved this to Backlog in Server Feb 21, 2026
@AenBleidd AenBleidd added this to the Server Release 1.6.2 milestone Feb 21, 2026
@AenBleidd AenBleidd merged commit 743902c into master Feb 21, 2026
429 checks passed
@AenBleidd AenBleidd deleted the dpa_assim2 branch February 21, 2026 16:14
@github-project-automation github-project-automation bot moved this from Backlog to Done in Server Feb 21, 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