Skip to content

add supported server resources checks #592

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

Open
wants to merge 5 commits into
base: remove-s3-bucket-polling
Choose a base branch
from

Conversation

MattShirley
Copy link
Collaborator

Adds client support for checking whether a server supports a given resource/endpoint.

This PR shows two implementation patterns:

  1. The actual ServiceXAdapter method that call a specific resource will throw an Exception/GuardList entry (instead of executing an HTTP request).
  2. Using the resource name as a feature flag to code old/new conditional branches.

@@ -229,6 +351,7 @@ async def delete_transform(self, transform_id=None):
f"Failed to delete transform {transform_id} - {msg}"
)

@requires_resource("transformationresults")
Copy link
Collaborator

Choose a reason for hiding this comment

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

In principle, in your code, we should never fail this check, right?

begin_at = new_begin_at
if transformation_results_enabled:
new_begin_at = datetime.datetime.now(tz=datetime.timezone.utc)
files = await self.servicex.get_transformation_results(
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there any reason that get_transformation_results can't just return the same list of objects that self.minio.list_bucket() would? This would simplify the failover logic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

list_bucket returns a list of objects with a filename attribute, while the ServiceX adapter call is just turning JSON into dictionaries which have a 'file-path' key. I can change the key name to 'filename', but I don't think it's a good idea to change the dictionaries to objects with filename attributes given that pattern isn't reused anywhere else in the ServiceX adapter.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In principle you could of course change the minio adapter to list the files with a dictionary instead of a list of objects of course... I would just like the "list of files to be downloaded" to be a type that doesn't depend on the source of the information.

Note also my comment on the backend PR - I'm concerned that this thing may need a new column in the database anyway, and whether you want to keep the same name may be up for discussion.

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