Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dataset] Gracefully handle all-None Chunkset #194

Merged
merged 2 commits into from
Jun 26, 2023

Conversation

TomAugspurger
Copy link
Contributor

This updates the behavior of the create items task when the user-provided create_items function returns None for every asset in the chunkfile.

Previously, we would only write an ndjson file to storage if there were any valid items returned by create_items. If the results were empty (no items were returned for the entire chunkfile) then we'd skip writing the output file.

This was incompatible with the ingest-items task, which assumes the file exists when it comes to reading. It would try to read the file and error, causing the run to fail.

We have (at least) two choices on how to reconcile this:

  1. Always write an ndjson file in create items, even if it's empty.
  2. Ignore missing files in ingest-items.

Option 1 feels much safer. Presumably the user knows what they're doing when they return None from their function. By the time we get to ingest-items, we have no idea why a file might be missing.

This updates the behavior of the create items task when the
user-provided `create_items` function returns `None` for every asset in
the chunkfile.

Previously, we would only write an ndjson file to storage if there were any
valid items returned by `create_items`. If the `results` were empty (no
items were returned for the entire chunkfile) then we'd skip writing the
output file.

This was incompatible with the `ingest-items` task, which assumes the
file exists when it comes to reading. It would try to read the file and
error, causing the run to fail.

We have (at least) two choices on how to reconcile this:

1. Always write an ndjson file in create items, even if it's empty.
2. Ignore missing files in ingest-items.

Option 1 feels much safer. Presumably the user knows what they're doing
when they return `None` from their function. By the time we get to
`ingest-items`, we have no idea why a file might be missing.
@TomAugspurger TomAugspurger merged commit 7eff05b into main Jun 26, 2023
@TomAugspurger TomAugspurger deleted the tom/fix/empty-chunksets branch June 26, 2023 12:02
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