Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API gateway versioning #354

Merged
merged 24 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions client/quantum_serverless/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
# gateway
GATEWAY_PROVIDER_HOST = "GATEWAY_PROVIDER_HOST"
GATEWAY_PROVIDER_VERSION = "v1"
Tansito marked this conversation as resolved.
Show resolved Hide resolved
GATEWAY_PROVIDER_VERSION_DEFAULT = "v1"

# auth
ENV_JOB_GATEWAY_TOKEN = "ENV_JOB_GATEWAY_TOKEN"
Expand Down
5 changes: 3 additions & 2 deletions client/quantum_serverless/core/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
ENV_JOB_GATEWAY_HOST,
ENV_JOB_ID_GATEWAY,
GATEWAY_PROVIDER_VERSION,
GATEWAY_PROVIDER_VERSION_DEFAULT,
)
from quantum_serverless.core.program import Program
from quantum_serverless.utils.json import is_jsonable
Expand Down Expand Up @@ -232,9 +233,9 @@ def save_result(result: Dict[str, Any]):
if version is None:
logging.warning(
"No `gateway` version provided. Default one will be configured: %s",
GATEWAY_PROVIDER_VERSION,
GATEWAY_PROVIDER_VERSION_DEFAULT,
)
version = GATEWAY_PROVIDER_VERSION
version = GATEWAY_PROVIDER_VERSION_DEFAULT

token = os.environ.get(ENV_JOB_GATEWAY_TOKEN)
if token is None:
Expand Down
5 changes: 3 additions & 2 deletions client/quantum_serverless/core/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
REQUESTS_TIMEOUT,
GATEWAY_PROVIDER_HOST,
GATEWAY_PROVIDER_VERSION,
GATEWAY_PROVIDER_VERSION_DEFAULT,
)
from quantum_serverless.core.job import (
Job,
Expand Down Expand Up @@ -501,9 +502,9 @@ def __init__(
if version is None:
logging.warning(
"No `gateway` version provided. Default one will be configured: %s",
GATEWAY_PROVIDER_VERSION,
GATEWAY_PROVIDER_VERSION_DEFAULT,
)
version = GATEWAY_PROVIDER_VERSION
version = GATEWAY_PROVIDER_VERSION_DEFAULT

if token is None and (username is None or password is None):
raise QuantumServerlessException(
Expand Down