Skip to content

Improved error handling for expeye posts - #960

Open
stephen-riggs wants to merge 4 commits into
mainfrom
more-expeye-fixes
Open

stephen-riggs wants to merge 4 commits into
mainfrom
more-expeye-fixes

Conversation

@stephen-riggs

@stephen-riggs stephen-riggs commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Various edits to make the expeye posts work properly and also to handle exceptions if the posts fail:

  • atlas colour channels cannot be None
  • foil hole names are strings in ispyb but ints in murfey which requires some conversion
  • requests for no foil holes should not be treated as failures
  • update atlas does not need dcg but the model does need atlas type

@codecov

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 17.24138% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.30%. Comparing base (b4dc02f) to head (6c42731).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #960      +/-   ##
==========================================
- Coverage   56.39%   56.30%   -0.09%     
==========================================
  Files         106      106              
  Lines       12153    12174      +21     
  Branches     1653     1658       +5     
==========================================
+ Hits         6854     6855       +1     
- Misses       4912     4931      +19     
- Partials      387      388       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

except json.JSONDecodeError:
logger.error("Expeye json decode failed")
return None
if not result.get("atlasId"):

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.

I don't think it's going to happen in production, but technically, this would fail if atlasId was 0. You'd want if result.get("atlasId") is None: instead.

Comment on lines 80 to +81
return None
return result["atlasId"]

@tieneupin tieneupin Dec 3, 2026 •

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.

Technically, you can just assign results.get("atlasId") to a variable and return it once at the end. No need for the separate return None.

if (atlas_id := result.get("atlasId")) is None:
    logger.error(f"Expeye atlas insert failed with {results}")
return atlas_id

Comment on lines +55 to +58
if not result.get("atlasId"):
logger.error(f"Expeye atlas insert failed with {result}")
return None
return result["atlasId"]

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.

Same here:

if (atlas_id := result.get("atlasId")) is None:
    logger.error(f"Expeye atlas insert failed with {results}")
return atlas_id

@tieneupin tieneupin 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.

Looks fine, as far as I can tell!

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.

2 participants