Skip to content
Snippets Groups Projects
Commit a1a64e41 authored by Timothe Jost's avatar Timothe Jost
Browse files

adding load_requirement ability to scan through kwargs to output what it...

adding load_requirement ability to scan through kwargs to output what it needs, if the arg is present, or not
parent 78a5df83
No related branches found
No related tags found
No related merge requests found
Pipeline #143020 passed
__version__ = "0.0.76"
__version__ = "0.0.77"
from . import loggs
from .pipes import *
......
......@@ -27,7 +27,7 @@ class BasePipeType(Protocol):
class BasePipe(BasePipeType, metaclass=ABCMeta):
# this class must implements only the logic to link steps together.
# this class implements only the logic to link steps together.
default_extra = None
......@@ -164,7 +164,7 @@ class BasePipe(BasePipeType, metaclass=ABCMeta):
self.pipeline.resolved = False
@property
def version(self):
def version(self) -> str:
"""Return a hash representing the versions of all steps in the object.
Returns:
......
from functools import wraps, partial, update_wrapper
from .loggs import loggedmethod, NAMELENGTH
from functools import wraps, partial, update_wrapper, cache
from .loggs import loggedmethod, NAMELENGTH, getLogger, PypelineLogger
from .arguments import autoload_arguments
from .utils import to_snake_case
......@@ -212,7 +212,7 @@ class BaseStep:
def __call__(self, *args, **kwargs):
"""Call the worker method with the given arguments and keyword arguments."""
return self.worker(*args, **kwargs)
return loggedmethod(self.worker)(*args, **kwargs)
def __repr__(self):
"""Return a string representation of the StepObject in the format: "<pipe_name.step_name StepObject>"."""
......@@ -720,7 +720,7 @@ class BaseStep:
return False
return True
def load_requirement(self, pipe_name, session, extra=None):
def load_requirement(self, pipe_name, session, extra=None, **kwargs) -> Any:
"""Load the specified requirement step for the given pipe name.
Args:
......@@ -734,6 +734,10 @@ class BaseStep:
Raises:
IndexError: If the required step with the specified pipe name is not found in the requirement stack.
"""
if pipe_name in kwargs.keys():
return kwargs[pipe_name]
try:
req_step = [step for step in self.requirement_stack() if step.pipe_name == pipe_name][-1]
except IndexError as e:
......@@ -767,6 +771,10 @@ class BaseStep:
"""
raise NotImplementedError
@property
def logger(self) -> PypelineLogger:
return getLogger(self.step_name[:NAMELENGTH])
@dataclass
class StepLevel:
......
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