Skip to content
Snippets Groups Projects
Commit c01c20e9 authored by Manon Blanco's avatar Manon Blanco
Browse files

Typing

parent 8dd86ac9
No related branches found
No related tags found
1 merge request!2Port init elements code
Pipeline #164735 passed
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
......@@ -3,6 +3,7 @@ import sqlite3
import sys
import uuid
from collections import OrderedDict
from collections.abc import Iterator
from logging import Logger, getLogger
from time import sleep
......@@ -25,7 +26,7 @@ PENDING_STATE = "pending"
ERROR_STATE = "error"
def split_chunks(items, n):
def split_chunks(items: list, n: int) -> Iterator[list]:
"""
Yield n number of elements from a given list with a balanced distribution
https://stackoverflow.com/questions/24483182/python-split-list-into-n-chunks#answer-54802737
......@@ -203,7 +204,7 @@ class InitElementWorker(BaseWorker):
return list(unique_elements.values())
def check_worker_activity(self):
def check_worker_activity(self) -> bool:
# Check if workers activity associated to this process is in a pending state
process = self.request("RetrieveProcess", id=self.process["id"])
if process.get("activity_state") == ERROR_STATE:
......@@ -229,7 +230,7 @@ class InitElementWorker(BaseWorker):
raise Exception("Worker activity timeout")
sleep(timer)
def run(self):
def run(self) -> None:
elements = self.list_process_elements()
self.dump_chunks(elements)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment