import shutil
import sys
import os
import time
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
import core.logger as logger
from core.behavior_tree import ReleaseFlowAction, ReleaseFlowActionDecorator
from thirdparty.py_trees.common import Status, Access
from database import *
from utils.shell import shell
log = logger.get_logger()

@ReleaseFlowActionDecorator
class _PhaseConfig_Process(ReleaseFlowAction):
    def setup(self):
        self.process_over = False

    def process(self):
        self.status = Status.RUNNING
        if self.process_over:
            self.status = Status.SUCCESS
            return self.Status
        self.blackboard.register_key(key="test_key")
        log.info(f"test_key: {self.blackboard.test_key}")
        
        self.process_over = True
        self.status = Status.SUCCESS
        return self.status

    def update(self):
        return self.status
