Skip to content

Commit

Permalink
[RPC] Format service.py to pass builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
sukritkalra committed Feb 13, 2024
1 parent 259f3ac commit 0422552
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions rpc/service.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import sys
import time
from concurrent import futures
from urllib.parse import urlparse
import time

sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
Expand Down Expand Up @@ -83,7 +83,7 @@ def RegisterFramework(self, request, context):
success=True,
message=f"{framework_name} at {self._master_uri} registered successfully!",
)

def RegisterTaskGraph(self, request, context):
"""Registers a new TaskGraph with the backend scheduler.
This is the entry point for a new application of Spark to register
Expand All @@ -94,13 +94,14 @@ def RegisterTaskGraph(self, request, context):
received_ts = time.time()
if app_id in self._all_task_graphs:
self._logger.warning(
"Registration failed for app_id %s and name %s. Was already registered!",
"The application with ID %s and name %s was already registered.",
app_id,
app_name,
)
return erdos_scheduler_pb2.RegisterTaskGraphResponse(
success=False,
message=f"Application ID {app_id} with name {app_name} already registered!"
message=f"Application ID {app_id} with name {app_name} "
f"already registered!",
)

# Setup a new TaskGraph (application).
Expand All @@ -112,13 +113,18 @@ def RegisterTaskGraph(self, request, context):
)

# Setup application information for servicer.
new_application = {"app_id": app_id, "app_name": app_name, "received_ts": received_ts}
new_application = {
"app_id": app_id,
"app_name": app_name,
"received_ts": received_ts,
}
self._all_task_graphs[app_id] = new_application

# Return the response.
return erdos_scheduler_pb2.RegisterTaskGraphResponse(
success=True,
message=f"Application ID {app_id} with name {app_name} registered successfully!",
message=f"Application ID {app_id} with name "
f"{app_name} registered successfully!",
)

def DeregisterFramework(self, request, context):
Expand Down

0 comments on commit 0422552

Please sign in to comment.