def execute(self, data, parent_data):
    if parent_data.get_one_of_inputs('language'):
        translation.activate(parent_data.get_one_of_inputs('language'))
    timing = data.get_one_of_inputs('bk_timing')
    force_check = data.get_one_of_inputs('force_check', True)
    project = Project.objects.get(id=parent_data.inputs.project_id)
    project_tz = timezone.pytz.timezone(project.time_zone)
    data.outputs.business_tz = project_tz
    now = datetime.datetime.now(tz=project_tz)
    if self.date_regex.match(str(timing)):
        eta = project_tz.localize(datetime.datetime.strptime(timing, '%Y-%m-%d %H:%M:%S'))
        if (force_check and (now > eta)):
            message = _('定时时间需晚于当前时间')
            data.set_outputs('ex_data', message)
            return False
    elif self.seconds_regex.match(str(timing)):
        eta = (now + datetime.timedelta(seconds=int(timing)))
    else:
        message = (_('输入参数%s不符合【秒(s) 或 时间(%%Y-%%m-%%d %%H:%%M:%%S)】格式') % timing)
        data.set_outputs('ex_data', message)
        return False
    self.logger.info('wake time: {}'.format(eta))
    data.outputs.timing_time = eta
    return True
def execute(self, data, parent_data):
    if parent_data.get_one_of_inputs('language'):
        translation.activate(parent_data.get_one_of_inputs('language'))
    timing = data.get_one_of_inputs('bk_timing')
    force_check = data.get_one_of_inputs('force_check', True)
    project = Project.objects.get(id=parent_data.inputs.project_id)
    project_tz = timezone.pytz.timezone(project.time_zone)
    data.outputs.business_tz = project_tz
    now = datetime.datetime.now(tz=project_tz)
    if self.date_regex.match(str(timing)):
        eta = project_tz.localize(datetime.datetime.strptime(timing, '%Y-%m-%d %H:%M:%S'))
        if (force_check and (now > eta)):
            message = _('定时时间需晚于当前时间')
            data.set_outputs('ex_data', message)
            return False
    elif self.seconds_regex.match(str(timing)):
        eta = (now + datetime.timedelta(seconds=int(timing)))
    else:
        message = (_('输入参数%s不符合【秒(s) 或 时间(%%Y-%%m-%%d %%H:%%M:%%S)】格式') % timing)
        data.set_outputs('ex_data', message)
        return False
    self.logger.info('wake time: {}'.format(eta))
    data.outputs.timing_time = eta
    return True