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

Issue 254 | Gateway service #274

Merged
merged 12 commits into from
Mar 21, 2023
Merged

Issue 254 | Gateway service #274

merged 12 commits into from
Mar 21, 2023

Conversation

IceKhan13
Copy link
Member

@IceKhan13 IceKhan13 commented Mar 13, 2023

Summary

Gateway service initial works.
Service for managing programs execution, setting limits, etc.

TODOs:

  • POC gateway
  • client integration
  • UML diagram
  • tests
  • docs
  • linter
  • update tutorials
  • commands to create user, compute resource, site, etc.
  • dockerfile
  • CI tests
  • job results

Details and comments

from quantum_serverless import QuantumServerless, Program, GatewayProvider, Provider
from quantum_serverless.core import ComputeResource

gateway_provider = GatewayProvider(
    username="john",
    password="password123",
    # token="<TOKEN>"  # alternatevely can provide token instead of user/password
    host="http://localhost:8000",
)

serverless = QuantumServerless([gateway_provider])

program = Program(
    name="awesome_program",
    entrypoint="program.py",
    working_dir="./",
    description="description of a program",
    version="0.0.1"
)

job = serverless.run_program(program)

job.logs()
job.result()

Requests flow

all_diagrams-serverless_ UML drawio (1)

General overview

all_diagrams-Gateway overview drawio

@IceKhan13 IceKhan13 added enhancement New feature or request priority: high High priority labels Mar 13, 2023
@IceKhan13 IceKhan13 added this to the 0.1 milestone Mar 13, 2023
@IceKhan13 IceKhan13 self-assigned this Mar 14, 2023
@Tansito Tansito self-requested a review March 15, 2023 12:01
@IceKhan13
Copy link
Member Author

IceKhan13 commented Mar 17, 2023

Number of things is still need to be polished and finished, but it will be separate PRs. Majority of work is done here.

Remaining things:

  • CI for nightly builds
  • more tests coverage
  • improve code quality (serialization, verification, ids of models in DB)
  • helm chart

@IceKhan13 IceKhan13 marked this pull request as ready for review March 17, 2023 23:47
Copy link
Member

@Tansito Tansito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job is awesome @IceKhan13 . I couldn't review correctly all the code but I started with the django part. I left some comments with doubts and another ones to discuss. Something in what we can work too is to sync a little bit the projects from repository and this one.

gateway/api/migrations/0001_initial.py Outdated Show resolved Hide resolved
gateway/api/models.py Outdated Show resolved Hide resolved
gateway/api/models.py Show resolved Hide resolved
gateway/api/serializers.py Show resolved Hide resolved
gateway/api/views.py Show resolved Hide resolved
gateway/gateway/settings.py Outdated Show resolved Hide resolved
gateway/gateway/urls.py Outdated Show resolved Hide resolved
gateway/gateway/__init__.py Outdated Show resolved Hide resolved
RUN chmod +x /usr/src/app/entrypoint.sh

# copy project
COPY . .
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This COPY overwrites the edited entrypoint.sh, doesn't it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point!

@psschwei
Copy link
Collaborator

Just to clarify, when creating the gateway provider, the host (host="http://localhost:8000") is the repository service? (that's the only one I see on k8s using port 8000)

@IceKhan13
Copy link
Member Author

Just to clarify, when creating the gateway provider, the host (host="http://localhost:8000") is the repository service? (that's the only one I see on k8s using port 8000)

No, it is gateway endpoint. And gateway is basically program runner middleware and that is it. Repository service will be living in some other host/port. At the end of the day it is just a matter of configuration.

@psschwei
Copy link
Collaborator

Whoops, I should've looked closer at the PR and not tried using the helm install here... will pop back over to docker-compose to poke around.

@IceKhan13
Copy link
Member Author

@psschwei btw, docker compose will be updated with #301 to latest Keycloak image

@IceKhan13 IceKhan13 requested a review from Tansito March 21, 2023 16:05
@IceKhan13 IceKhan13 marked this pull request as draft March 21, 2023 16:21
@IceKhan13 IceKhan13 marked this pull request as ready for review March 21, 2023 16:22
@pacomf
Copy link
Member

pacomf commented Mar 21, 2023

@psschwei the idea for the near future is use the gateway like entrypoint (to connect with repository, keycloak, etc), so we will have just one interface (API Gateway) to connect from Middleware client

@akihikokuroda
Copy link
Collaborator

When is the Job in the gateway deleted? I haven't looked though changes yet so I might miss it.

@IceKhan13
Copy link
Member Author

it remains there for references, until user decides to delete it @akihikokuroda . We can put ttl or something like this later on

Copy link
Member

@Tansito Tansito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@pacomf pacomf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "0.1.0" better?

rayHost: "http://serverless-cluster-kuberay-head-svc:8265"
keycloak:
clientId: "gateway-client"
url: "http://serverless-cluster-keycloak/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is serverless-cluster your helm install release name? Would you replace it with HELM-RELEASE

realm: "quantumserverless"
clientSecret: "secret"
clientName: "gateway-client"
superuser:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used?

Copy link
Collaborator

@akihikokuroda akihikokuroda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Great work! There are some minor comments but I approve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: high High priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor: update QuantumServerless.__init__ to accept list of Providers
5 participants