Commit b959fa81 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

updated processor module

parent 7e6af829
from abc import ABCMeta, abstractmethod
from abc import ABC, ABCMeta, abstractmethod
from enum import Enum
......@@ -8,26 +8,52 @@ class CsstProcStatus(Enum):
ioerror = 1
runtimeerror = 2
# self['empty'].info = 'Not run yet.'
# self['normal'].info = 'This is a normal run.'
# self['ioerror'].info = 'This run is exceptionally stopped due to IO error.'
# self['runtimeerror'].info = 'This run is exceptionally stopped due to runtime error.'
class CsstProcessor(metaclass=ABCMeta):
class CsstProcessor(ABC):
def __init__(self, **kwargs):
self._status = CsstProcStatus()
# self._status = CsstProcStatus()
pass
@abstractmethod
def prepare(self, **kwargs):
pass
# do your preparation here
raise NotImplementedError
@abstractmethod
def run(self, kwargs):
""" """
return self._status
def run(self, **kwargs):
# run your pipeline
raise NotImplementedError
@abstractmethod
def cleanup(self):
pass
# clean up environment
raise NotImplementedError
class CsstDemoProcessor(CsstProcessor):
def __init__(self, **kwargs):
super().__init__()
def some_function(self, **kwargs):
print("some function")
def prepare(self):
print("prepare")
def run(self):
print("run")
def cleanup(self):
print("clear up")
if __name__ == "__main__":
cp = CsstDemoProcessor()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment