2024-10-01 19:19:35 +00:00
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
|
2024-11-27 12:50:58 +00:00
|
|
|
from . import Workflow
|
2024-10-01 19:19:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
class HookInterface(ABC):
|
|
|
|
@abstractmethod
|
|
|
|
def pre_run(self, _workflow, _job):
|
|
|
|
"""
|
|
|
|
runs in pre-run step
|
|
|
|
:param _workflow:
|
|
|
|
:param _job:
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def run(self, _workflow, _job):
|
|
|
|
"""
|
|
|
|
runs in run step
|
|
|
|
:param _workflow:
|
|
|
|
:param _job:
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def post_run(self, _workflow, _job):
|
|
|
|
"""
|
|
|
|
runs in post-run step
|
|
|
|
:param _workflow:
|
|
|
|
:param _job:
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def configure(self, _workflow: Workflow.Config):
|
|
|
|
"""
|
|
|
|
runs in initial WorkflowConfig job in run step
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
pass
|