Commit 68ef2c43 authored by Cage, Gregory's avatar Cage, Gregory
Browse files

Merge branch '26-add-file-type-dataset' into 'main'

Expose check_url when getting url from tool

See merge request ndip/public-packages/nova-galaxy!17
parents 3d1f8e41 51724ca1
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
[tool.poetry]
name = "nova-galaxy"
version = "0.7.3"
version = "0.7.4"
description = "Utilties for accessing the ORNL Galaxy instance"
authors = ["Greg Watson <watsongr@ornl.gov>", "Gregory Cage <cagege@ornl.gov>"]
readme = "README.md"
+5 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ class Datastore:
        self.name = name
        self.nova_connection = nova_connection
        self.history_id = history_id
        self.persist_store = False
        self.persist_store = True

    def persist(self) -> None:
        """Persist this store even after the nova connection is closed.
@@ -28,6 +28,10 @@ class Datastore:
        """
        self.persist_store = True

    def mark_for_cleanup(self) -> None:
        """Clean up and delete all content related to this Data Store after the associated connection is closed."""
        self.persist_store = False

    def recover_tools(self, filter_running: bool = True) -> List[Tool]:
        """Recovers all running tools in this data_store.

+2 −4
Original line number Diff line number Diff line
@@ -163,13 +163,11 @@ class DatasetCollection(AbstractData):
            raise Exception("Dataset collection is not present in Galaxy.")

    def get_content(self) -> Any:
        """Get a list of the content of this Collection along with info on each element."""
        if self.store and self.id:
            dataset_client = DatasetCollectionClient(self.store.nova_connection.galaxy_instance)
            info = dataset_client.show_dataset_collection(self.id)
            output = ""
            for element in info["elements"]:
                output += f"{element['element_identifier']}\n"
            return output
            return info["elements"]
        else:
            raise Exception("Dataset collection is not present in Galaxy.")

+4 −2
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ class Tool(AbstractWork):
            return self._job.get_console_output()["stderr"]
        return None

    def get_url(self, max_tries: int = 5) -> Optional[str]:
    def get_url(self, max_tries: int = 5, check_url: bool = False) -> Optional[str]:
        """Get the URL for this tool.

        If this is an interactive tool, then will return the endpoint to the tool. The first call may need to query
@@ -178,9 +178,11 @@ class Tool(AbstractWork):
        ----------
        max_tries: int
            How many attempts to obtain the url.
        check_url: bool
            Whether to check the URL for a 200 response before returning. If the request is unsuccessful, returns None.
        """
        if self._job:
            return self._job.get_url(max_tries=max_tries, check_url=False)
            return self._job.get_url(max_tries=max_tries, check_url=check_url)
        return None

    def get_uid(self) -> Optional[str]:
+2 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ TEST_INT_TOOL_ID = "interactive_tool_generic_output"
def test_no_persist_store(nova_instance: Connection, galaxy_instance: GalaxyInstance) -> None:
    with nova_instance.connect() as connection:
        store = connection.create_data_store(name="nova_galaxy_testing")
        store.mark_for_cleanup()
        history = galaxy_instance.histories.get_histories(name=store.name)
        assert len(history) > 0
    history = galaxy_instance.histories.get_histories(name=store.history_id, deleted=False)
@@ -43,6 +44,7 @@ def test_recover_tools(nova_instance: Connection) -> None:

    with nova_instance.connect() as connection:
        store = connection.create_data_store(name="nova_galaxy_testing")
        store.mark_for_cleanup()
        tools = store.recover_tools()
        assert len(tools) > 0
        assert tools[0].get_url() is not None
Loading