Skip to content
Snippets Groups Projects
Commit 2819599c authored by Chaza Abdelwahab's avatar Chaza Abdelwahab
Browse files

push for debug

parent e0c32a44
No related tags found
1 merge request!176Draft: Resolve "Move developer setup in a dedicated method"
Pipeline #79284 failed
......@@ -67,6 +67,7 @@ class ElementsWorker(
"""
def __init__(self, description="Arkindex Elements Worker", support_cache=False):
print("in __init__ in __init__.py before super")
super().__init__(description, support_cache)
# Add mandatory argument to process elements
self.parser.add_argument(
......@@ -81,6 +82,7 @@ class ElementsWorker(
nargs="+",
help="One or more Arkindex element ID",
)
print("in __init__ in __init__.py after super")
self.classes = {}
......@@ -135,8 +137,12 @@ class ElementsWorker(
return self.process_information.get("activity_state") == "ready"
def configure(self):
super().configure()
super().configure_cache()
print("in configure in __init__.py")
if self.is_read_only:
super().configure_for_developers()
else:
super().configure()
super().configure_cache()
# Add report concerning elements
self.report = Reporter(
......
......@@ -57,7 +57,7 @@ class BaseWorker(object):
:param support_cache bool: Whether or not this worker supports the cache database.
Override the constructor and set this parameter to start using the cache database.
"""
print("in __init__ in base.py")
self.parser = argparse.ArgumentParser(description=description)
# Setup workdir either in Ponos environment or on host's home
......@@ -121,6 +121,9 @@ class BaseWorker(object):
# Call potential extra arguments
self.add_arguments()
# CLI args are stored on the instance so that implementations can access them
self.args = self.parser.parse_args()
@property
def is_read_only(self) -> bool:
"""
......@@ -133,8 +136,6 @@ class BaseWorker(object):
return self.args.dev or self.worker_version_id is None
def configure_for_developers(self):
# CLI args are stored on the instance so that implementations can access them
self.args = self.parser.parse_args()
# Setup logging level
if self.args.verbose:
logger.setLevel(logging.DEBUG)
......@@ -160,8 +161,7 @@ class BaseWorker(object):
"""
Configure worker using CLI args and environment variables.
"""
# CLI args are stored on the instance so that implementations can access them
self.args = self.parser.parse_args()
assert not self.is_read_only
# Build Arkindex API client from environment variables
self.api_client = ArkindexClient(**options_from_env())
logger.debug(f"Setup Arkindex API client on {self.api_client.document.url}")
......
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