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

Modify compound ingest operation to wait for table build completion #970

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

kroenlein
Copy link
Collaborator

Citrine Python PR

Description

This PR updates the poll_for_job_completion method in ingestion to continue blocking until a table is built if the build_table option was true.

This PR also

  • updates the status attribute of Job objects to be an enumeration (as per the API spec), maintaining support for arbitrary strings with issued deprecation warnings.
  • Adds a deprecation warning for any use of project_id on an Ingestion object, whereas before only changing the value issued this warning

PR Type:

  • Breaking change (fix or feature that would cause existing functionality to change)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Maintenance (non-breaking change to assist developers)

Adherence to team decisions

  • I have added tests for 100% coverage
  • I have written Numpy-style docstrings for every method and class.
  • I have communicated the downstream consequences of the PR to others.
  • I have bumped the version in __version__.py

@kroenlein kroenlein requested a review from a team as a code owner October 9, 2024 20:55
""":str: The status of the job. One of "Running", "Success", or "Failure"."""
tasks = properties.List(Object(TaskNode), "tasks")
""":List[TaskNode]: all of the constituent task required to complete this job"""
output = properties.Optional(properties.Mapping(String, String), 'output')
""":Optional[dict[str, str]]: job output properties and results"""

@property
def status(self) -> Union[JobStatus, str]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since BaseEnumeration has str as a superclass, returning a JobStatus would not lead to a change in behavior, so this is not an API break.

return self._status

@status.setter
def status(self, value):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: type hint

@status.setter
def status(self, value):
if resolved := JobStatus.from_str(value, exception=False):
if resolved not in [JobStatus.RUNNING, JobStatus.SUCCESS, JobStatus.FAILURE]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this support any valid JobStatus value? If so, you can use list(JobStatus) to ensure it's resilient against typos and future code changes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, I see. That's strange, that the Response can't take the other statuses. Not even Pending?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's what's documented. This ought to just be a read only object, so maybe we don't care about the fact that the far end will only ever return a subset.

anoto-moniz
anoto-moniz previously approved these changes Oct 10, 2024
@kroenlein kroenlein merged commit e57e092 into main Oct 11, 2024
16 checks passed
@kroenlein kroenlein deleted the bugfix/wait-on-table-build branch October 11, 2024 15:57
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