Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
akihikokuroda committed Nov 16, 2023
1 parent f6f04f2 commit 955c510
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
17 changes: 8 additions & 9 deletions gateway/api/ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,28 +87,27 @@ def submit(self, job: Job) -> Optional[str]:
except KeyError:
pass

f = open(extract_folder + "/launcher.py", "w")
f.write(
'''
with open(extract_folder + "/launcher.py", "w", encoding="utf-8") as f:
f.write(
"""
import subprocess
from subprocess import Popen
import sys
from quantum_serverless import set_status
with Popen(
["python", sys.argv[1]],
['python', sys.argv[1]],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
) as pipe:
status = "SUCCEEDED"
status = 'SUCCEEDED'
if pipe.wait():
status = "FAILED"
status = 'FAILED'
output, _ = pipe.communicate()
print(output)
set_status(status)
'''
)
f.close()
"""
)

ray_job_id = retry_function(
callback=lambda: self.client.submit_job(
Expand Down
1 change: 0 additions & 1 deletion gateway/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ def run(self, request):
status=Job.QUEUED,
config=jobconfig,
)
job.save()

carrier = {}
TraceContextTextMapPropagator().inject(carrier)
Expand Down
4 changes: 3 additions & 1 deletion gateway/main/signals.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Model signal processing."""
from django.db.models.signals import post_save
from django.dispatch import receiver
from api.models import Job
Expand All @@ -6,7 +7,8 @@


@receiver(post_save, sender=Job)
def save_job(sender, instance, created, **kwargs):
def save_job(sender, instance, created, **kwargs): # pylint: disable=unused-argument
"""procss save Job model entry event."""
print("save_job")
print(instance)
print("Free")
Expand Down
5 changes: 3 additions & 2 deletions gateway/main/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
from django.urls import path, include, re_path
from django.views.generic import TemplateView
from rest_framework import routers
from .signals import save_job

from api.views import KeycloakLogin, KeycloakUsersView
import probes.views

from .signals import save_job # pylint: disable=unused-import


router = routers.DefaultRouter()


Expand Down

0 comments on commit 955c510

Please sign in to comment.