Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
799 changes: 399 additions & 400 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ readme = "README.md"
repository = "https://github.com/saagie/api-saagie"

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.10"
requests = "2.29.0"
gql = "^3.0.0"
pytz = ">=2021.1"
Expand Down Expand Up @@ -79,4 +79,4 @@ exclude = '''
[tool.isort]
profile = "black"
line_length = 120
skip_glob = ["docs", "notes"]
skip_glob = ["docs", "notes"]
7 changes: 5 additions & 2 deletions saagieapi/saagie_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __init__(
realm: str,
retries: int = 0,
pprint_global: bool = False,
timeout: int = 10,
):
"""
Parameters
Expand All @@ -63,6 +64,8 @@ def __init__(
Pre-setup of the requests’ Session for performing retries
pprint_global : bool
Change the default pprint of all the requests made with this client
timeout: int
Pre-setup of the requests' Session Timeout, default to 10 seconds
"""
if not url_saagie.endswith("/"):
url_saagie += "/"
Expand All @@ -74,10 +77,10 @@ def __init__(
)
logging.info("✅ Successfully connected to your platform %s", self.url_saagie)
url_api = f"{self.url_saagie}projects/api/platform/{id_platform}/graphql"
self.client = GqlClient(auth=self.auth, api_endpoint=url_api, retries=retries)
self.client = GqlClient(auth=self.auth, api_endpoint=url_api, timeout=timeout, retries=retries)

url_gateway = f"{self.url_saagie}gateway/api/graphql"
self.client_gateway = GqlClient(auth=self.auth, api_endpoint=url_gateway, retries=retries)
self.client_gateway = GqlClient(auth=self.auth, api_endpoint=url_gateway, timeout=timeout, retries=retries)

self.projects = Projects(self)
self.jobs = Jobs(self)
Expand Down
8 changes: 5 additions & 3 deletions saagieapi/utils/gql_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@


class GqlClient:
def __init__(self, api_endpoint: str, auth: BearerAuth, retries: int = 0):
def __init__(self, api_endpoint: str, auth: BearerAuth, timeout: int, retries: int = 0):
self.auth = auth
self._transport = RequestsHTTPTransport(
url=api_endpoint, auth=auth, use_json=True, verify=False, retries=retries, timeout=10
url=api_endpoint, auth=auth, use_json=True, verify=False, retries=retries, timeout=timeout
)
self.client: Client = Client(
transport=self._transport, fetch_schema_from_transport=True, execute_timeout=timeout
)
self.client: Client = Client(transport=self._transport, fetch_schema_from_transport=True)

def execute(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
}
],
"isMajor": false,
"runtimeContextLabel": "JupyterLab+GenAI 4.0 Python 3.10"
"runtimeContextLabel": "JupyterLab+GenAI 4.0 Python 3.11"
}
],
"currentVersion": {
Expand Down Expand Up @@ -88,7 +88,7 @@
}
],
"isMajor": false,
"runtimeContextLabel": "JupyterLab+GenAI 4.0 Python 3.10"
"runtimeContextLabel": "JupyterLab+GenAI 4.0 Python 3.11"
},
"history": {
"id": "d6db9c91-0b02-4dd2-a611-cb39fc4d76b3",
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/storages_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def create_app_from_catalog(create_global_project):
project_id=conf.project_id,
technology_catalog="Saagie",
technology_name="Jupyter Notebook",
context="JupyterLab+GenAI 4.0 Python 3.10",
context="JupyterLab+GenAI 4.0 Python 3.11",
)
app_id = create_app["installApp"]["id"]

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/apps_unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,9 @@ def test_import_app_success(self, saagie_api_mock, tmp_path):
"technology": {
"appContexts": [
{
"id": "JupyterLab+GenAI 4.0 Python 3.10",
"id": "JupyterLab+GenAI 4.0 Python 3.11",
"available": True,
"label": "JupyterLab+GenAI 4.0 Python 3.10",
"label": "JupyterLab+GenAI 4.0 Python 3.11",
}
]
}
Expand Down Expand Up @@ -678,9 +678,9 @@ def test_import_app_error_runtime(self, saagie_api_mock, tmp_path):
"technology": {
"appContexts": [
{
"id": "JupyterLab+GenAI 4.0 Python 3.10",
"id": "JupyterLab+GenAI 4.0 Python 3.11",
"available": False,
"label": "JupyterLab+GenAI 4.0 Python 3.10",
"label": "JupyterLab+GenAI 4.0 Python 3.11",
}
]
}
Expand Down