Unverified Commit ab827580 authored by John Duggan's avatar John Duggan Committed by GitHub
Browse files

Merge pull request #43 from nova-model/42-improve-the-performance-of-get_url

Don't call sleep on first pass and skip URL requests if check_url=False
parents 6748ad8a f2e6b2eb
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
## Nova Galaxy 0.12.0 (in progress)

### Nova Galaxy 0.11.1
- Improved the performance of Job.get_url when check_url parameter is set to False (thanks to John Duggan). [Pull request 43](https://github.com/nova-model/nova-galaxy/pull/43)

### Nova Galaxy 0.11.0
- Added detailed job status (thanks to Sergey Yakubov) [Pull request 40](https://github.com/nova-model/nova-galaxy/pull/40)
+1 −1
Original line number Diff line number Diff line
[tool.poetry]
name = "nova-galaxy"
version = "0.11.0"
version = "0.11.1"
description = "Utilties for accessing the ORNL Galaxy instance"
authors = ["Greg Watson <watsongr@ornl.gov>", "Gregory Cage <cagege@ornl.gov>", "Sergey Yakubov <yakubovs@ornl.gov>"]
readme = "README.md"
+9 −3
Original line number Diff line number Diff line
@@ -322,6 +322,8 @@ class Job:
            return self.url
        timer = max_tries
        while timer > 0:
            if timer < max_tries:
                time.sleep(1)
            try:
                entry_points = self.galaxy_instance.make_get_request(
                    f"{self.store.nova_connection.galaxy_url}/api/entry_points?job_id={self.id}"
@@ -329,15 +331,19 @@ class Job:
                for ep in entry_points.json():
                    if ep["job_id"] == self.id and ep.get("target", None):
                        url = f"{self.store.nova_connection.galaxy_url}{ep['target']}"

                        if not check_url:
                            self.url = url
                            return url

                        response = self.galaxy_instance.make_get_request(url)
                        if response.status_code == 200 or not check_url:
                        if response.status_code == 200:
                            self.url = url
                            return url
            except Exception:
                continue
            finally:
                timer -= 1
                time.sleep(1)
        return None

    def get_console_output(self, start: int, length: int) -> Dict[str, str]: