Skip to content

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

Merged
kroenlein merged 2 commits intomainfrom
bugfix/wait-on-table-build
Oct 11, 2024
Merged

Modify compound ingest operation to wait for table build completion#970
kroenlein merged 2 commits intomainfrom
bugfix/wait-on-table-build

Conversation

@kroenlein
Copy link
Copy Markdown
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
Comment thread src/citrine/jobs/job.py
""":Optional[dict[str, str]]: job output properties and results"""

@property
def status(self) -> Union[JobStatus, str]:
Copy link
Copy Markdown
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.

Comment thread src/citrine/jobs/job.py Outdated
return self._status

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

Choose a reason for hiding this comment

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

Nitpick: type hint

Comment thread src/citrine/jobs/job.py
@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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