umccr-illumina / libica

:snake: Python SDK for Illumina Connected Analytics (ICA) :dragon:
MIT License
5 stars 4 forks source link

Download Pipeline File Content Endpoint fails when file name is in a subdirectory #137

Open alexiswl opened 2 weeks ago

alexiswl commented 2 weeks ago

Steps to reproduce

pipeline_id = "a10cad1d-b3c6-4a6e-8f44-0605fbe269d5"
#  file_id="0a7b29b7-ae8f-4198-85f3-0743f8290a25"  # works fine
file_id = "31a36b7a-f034-4bbc-ba3e-229d6ab866f4"

 # Enter a context with an instance of the API client
with ApiClient(get_icav2_configuration()) as api_client:
    # Create an instance of the API class
    api_instance = PipelineApi(api_client)

# example passing only required values which don't have defaults set
try:
    # Download the contents of a pipeline file.
    api_response: file_type = api_instance.download_pipeline_file_content(pipeline_id, file_id)
except ApiException as e:
    logger.error("Exception when calling PipelineApi->download_pipeline_file_content: %s\n" % e)
    raise ApiException

Gives the following traceback

Traceback (most recent call last):
  File "/home/alexiswl/GitHub/UMCCR/icav2-cli-plugins/src/icav2_cli_plugins/run/icav2-cli-plugins.py", line 14, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/alexiswl/GitHub/UMCCR/icav2-cli-plugins/src/icav2_cli_plugins/utils/cli.py", line 113, in main
    _dispatch()
  File "/home/alexiswl/GitHub/UMCCR/icav2-cli-plugins/src/icav2_cli_plugins/utils/cli.py", line 105, in _dispatch
    subcommand_obj()
  File "/home/alexiswl/GitHub/UMCCR/icav2-cli-plugins/src/icav2_cli_plugins/subcommands/__init__.py", line 723, in __call__
    self.subcommand_obj()
  File "/home/alexiswl/GitHub/UMCCR/icav2-cli-plugins/src/icav2_cli_plugins/subcommands/projectpipelines/create_wes_input_template.py", line 230, in __call__
    self.write_output_wes_template()
  File "/home/alexiswl/GitHub/UMCCR/icav2-cli-plugins/src/icav2_cli_plugins/subcommands/projectpipelines/create_wes_input_template.py", line 489, in write_output_wes_template
    "inputs": self.get_input_template_as_commented_map()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexiswl/GitHub/UMCCR/icav2-cli-plugins/src/icav2_cli_plugins/subcommands/projectpipelines/create_wes_input_template.py", line 273, in get_input_template_as_commented_map
    download_nextflow_schema_input_json_from_pipeline_id(
  File "/home/alexiswl/GitHub/UMCCR/wrapica/src/wrapica/utils/nextflow_helpers.py", line 604, in download_nextflow_schema_input_json_from_pipeline_id
    download_pipeline_file(
  File "/home/alexiswl/GitHub/UMCCR/wrapica/src/wrapica/pipelines/functions/pipelines_functions.py", line 264, in download_pipeline_file
    api_response: file_type = api_instance.download_pipeline_file_content(pipeline_id, file_id)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexiswl/PyCharmProjects/UMCCR/icav2-cli-plugins/venv/lib/python3.12/site-packages/libica/openapi/v2/api/pipeline_api.py", line 548, in download_pipeline_file_content
    return self.download_pipeline_file_content_endpoint.call_with_http_info(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexiswl/PyCharmProjects/UMCCR/icav2-cli-plugins/venv/lib/python3.12/site-packages/libica/openapi/v2/api_client.py", line 854, in call_with_http_info
    return self.api_client.call_api(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexiswl/PyCharmProjects/UMCCR/icav2-cli-plugins/venv/lib/python3.12/site-packages/libica/openapi/v2/api_client.py", line 409, in call_api
    return self.__call_api(resource_path, method,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexiswl/PyCharmProjects/UMCCR/icav2-cli-plugins/venv/lib/python3.12/site-packages/libica/openapi/v2/api_client.py", line 224, in __call_api
    return_data = self.deserialize(
                  ^^^^^^^^^^^^^^^^^
  File "/home/alexiswl/PyCharmProjects/UMCCR/icav2-cli-plugins/venv/lib/python3.12/site-packages/libica/openapi/v2/api_client.py", line 314, in deserialize
    return deserialize_file(response.data, self.configuration,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alexiswl/PyCharmProjects/UMCCR/icav2-cli-plugins/venv/lib/python3.12/site-packages/libica/openapi/v2/model_utils.py", line 1405, in deserialize_file
    with open(path, "wb") as f:
         ^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/assets/schema_input.json'