File indexing completed on 2026-04-10 08:39:07
0001 from pandaserver.workflow.workflow_base import (
0002 WFDataSpec,
0003 WFDataStatus,
0004 WFDataTargetCheckResult,
0005 WFDataType,
0006 WFStepSpec,
0007 WFStepStatus,
0008 WFStepTargetCheckResult,
0009 WFStepTargetSubmitResult,
0010 WFStepType,
0011 WorkflowSpec,
0012 WorkflowStatus,
0013 )
0014
0015
0016 class BaseDataHandler:
0017 """
0018 Base class for data handlers in the workflow system.
0019 This class provides a common interface and some utility methods for data handlers.
0020 """
0021
0022 def __init__(self, task_buffer, ddm_if, *args, **kwargs):
0023 """
0024 Initialize the step handler with necessary parameters.
0025
0026 Args:
0027 task_buffer: The task buffer interface to interact with the task database.
0028 ddm_if: The DDM interface to interact with the DDM system.
0029 *args: Additional positional arguments.
0030 **kwargs: Additional keyword arguments.
0031 """
0032 self.tbif = task_buffer
0033 self.ddm_if = ddm_if
0034
0035 def check_target(self, data_spec: WFDataSpec, **kwargs) -> WFDataTargetCheckResult:
0036 """
0037 Check the status of the data target.
0038 This method should be implemented by subclasses to handle the specifics of data target status checking.
0039 This method should NOT modify data_spec. Any update information should be stored in the WFStepTargetCheckResult returned instead.
0040
0041 Args:
0042 data_spec (WFDataSpec): The data specification to check.
0043 **kwargs: Additional keyword arguments.
0044
0045 Returns:
0046 WFDataTargetCheckResult: The result of the target check.
0047 """
0048 raise NotImplementedError("Subclasses must implement this method.")