zooniverse/panoptes-python-client

Caesar connections don't respect the connected API end points

Closed this issue · 1 comments

I'm writing scripts to configure caesar and using the staging system to test my work. I connect to the Panoptes and Caesar APIs using the endpoint overrides and look up a workflow to configure like so

Panoptes.connect(login='interactive', endpoint=panoptes_endpoint)
caesar = Caesar(endpoint=caesar_endpoint)
workflow = Workflow.find(args.workflow_id) # hits the correct API env

However when i then try and use that workflow to find existing extractors it fails to connect to the correct caesar env endpoints and defaults to production system

extractors = workflow.caesar_extractors()

This seems due to the fact that here

return Caesar().save_workflow(self.id, public_extracts, public_reductions)
we setup a new caeasr instance and don't respect the endpoint of the existing resource connection so it defaults to prod here
endpoint='https://caesar.zooniverse.org',

I can work around by interacting directly with a preconfigured caesar client e.g. caesar.get_workflow(workflow.id) but the exposed public API from the Workflow resource should respect the endpoint.

One possible solution is to reflect on the panoptes connection endpoint when auto-creating the caesar connection and inject the correct endpoint based on this, or do the refelction in the intializer of caesar.

 Panoptes._local.panoptes_client.endpoint # returns 'https://panoptes-staging.zooniverse.org'

I'll work around it using caesar directly in the meantime but worth noting that caesar client won't work against staging the way it's currently setup.

#307 closes issue. Fix will be in the next release