class MultiTask(Task):
    def __init__(self, config=None):
        self.agent = Agent(config=config)

    def step(self, state):
        action = 101
        terminate = False
        if state in self.terminal_state:
            terminate = True
        else:
            action = self.agent.egreedy_action(state)
        return action, terminate

    def nlg(self, action):
        return 'action is: {}'.format(action)
class MultiTask(Task):
    def __init__(self, config):
        super(MultiTask, self).__init__(config)
        self.agent = Agent(config=config)

    '''
    def decorator_name(f):
    @wraps(f)
    def decorated(*args, **kwargs):
        if not can_run:
            return "Function will not run"
        return f(*args, **kwargs)
    return decorated

    @decorator_name
    def func():
        return("Function is running")
    '''

    @parse_output
    def format_slots(self, output):
        slots = output['slots']
        slots_values = output['slots']
        slots_values_dict = {}
        slots_to_index = self.config['slots_to_index']
        for slot, slot_value in zip(slots, slots_values):
            self.state[slots_to_index[slot]] = 1
            slots_values_dict[slot] = slot_value
        return self.state

    def step(self, state):
        action = 101
        terminate = False
        if state in self.terminal_state:
            terminate = True
        else:
            action = self.agent.egreedy_action(state)
            logging.info('state:{}; action:{}'.format(state, action))
        return action, terminate