broadinstitute/fiss

Setting alternate endpoint (root URL) has no effect (cause and proposed fix provided)

Closed this issue · 1 comments

This fiss infrastructure is setup to support specification of alternate firecloud endpoints, yet the fiss/fapi operations are always performed on the default firecloud URL (https://api.firecloud.org/api/)

For example, the following code should list the workspaces in the dev deployment, but instead it lists the workspaces in the production deployment (https://api.firecloud.org/api/):

from firecloud import api as fapi

root_api = "https://firecloud-orchestration.dsde-dev.broadinstitute.org/api/"

fapi.fcconfig.set_root_url(root_api)

response  = fapi.list_workspaces()
print(response.text)

This is occurring because the fiss api functions have signatures with default parameter values, like the following:

def __get(methcall, headers=None, root_url=fcconfig.root_url, **kwargs):

The parameter root_url=fcconfig.root_url looks reasonable, yet Python only evaluates default parameter values once, at the time the function is defined, and for fiss, this is at import time.
Thus, the effective value of root_url is always the default value at the time of import (https://api.firecloud.org/api/) rather than any other value the user may configure.

One way this may easily be fixed is shown below. Updating these four api.py functions as shown enables the code sample above to correctly display the workspaces in the dev deployment.

image

Hi @mikebaumann,

Thanks for bringing this to my attention
Currently, you can get around this by using a .fissconfig file in your home directory. To get the behavior you would expect, the alternate URL should be set like so within the config file:

[DEFAULT]
root_url=<alternate api path>