Skip to content

Commit

Permalink
fixes for E501 errors (line too long)
Browse files Browse the repository at this point in the history
  • Loading branch information
sametd committed Aug 19, 2024
1 parent 69f503e commit 620a9f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
12 changes: 4 additions & 8 deletions polytope_server/broker/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

class Broker:
def __init__(self, config):

queue_config = config.get("queue")
self.queue = queue.create_queue(queue_config)

Expand All @@ -41,15 +40,13 @@ def __init__(self, config):
self.collections = collection.create_collections(config.get("collections"))

def run(self):

logging.info("Starting broker...")
logging.info("Maximum Queue Size: {}".format(self.max_queue_size))

while not time.sleep(self.scheduling_interval):
self.check_requests()

def check_requests(self):

self.queue.keep_alive()

# Don't queue if full. We don't need to query request_store.
Expand All @@ -72,7 +69,6 @@ def check_requests(self):

# Loop through requests queuing anything that meets QoS requirements
for wr in waiting_requests: # should break if queue full

if self.check_limits(active_requests, wr):
assert wr.status == Status.WAITING
active_requests.add(wr)
Expand All @@ -83,7 +79,6 @@ def check_requests(self):
return

def check_limits(self, active_requests, request):

logging.debug(f"Checking limits for request {request.id}")

# Get collection limits and calculate active requests
Expand Down Expand Up @@ -113,12 +108,14 @@ def check_limits(self, active_requests, request):
)
if user_active_requests >= limit:
logging.debug(
f"User {request.user} has {user_active_requests} of {limit} active requests in collection {request.collection}"
f"User {request.user} has {user_active_requests} of {limit} "
f"active requests in collection {request.collection}"
)
return False
else:
logging.debug(
f"User {request.user} has {user_active_requests} of {limit} active requests in collection {request.collection}"
f"User {request.user} has {user_active_requests} of {limit} "
f"active requests in collection {request.collection}"
)
return True

Expand All @@ -127,7 +124,6 @@ def check_limits(self, active_requests, request):
return True

def enqueue(self, request):

logging.info("Queuing request", extra={"request_id": request.id})

try:
Expand Down
5 changes: 2 additions & 3 deletions polytope_server/common/datasource/ionbeam.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ def archive(self, request, file) -> requests.Response:

class IonBeamDataSource(datasource.DataSource):
"""
Retrieve data from the IonBeam REST backend that lives here: https://github.com/ecmwf/IonBeam-Deployment/tree/main/docker/rest_api
Retrieve data from the IonBeam REST backend that lives here:
https://github.com/ecmwf/IonBeam-Deployment/tree/main/docker/rest_api
"""

read_chunk_size = 2 * 1024 * 1024
Expand Down

0 comments on commit 620a9f4

Please sign in to comment.