Merge "Avoid comparision between "None" type and "int" type."
This commit is contained in:
commit
f7ee8114e2
|
@ -43,7 +43,7 @@ class ExecutionExpirationPolicy(periodic_task.PeriodicTasks):
|
||||||
interval = CONF.execution_expiration_policy.evaluation_interval
|
interval = CONF.execution_expiration_policy.evaluation_interval
|
||||||
older_than = CONF.execution_expiration_policy.older_than
|
older_than = CONF.execution_expiration_policy.older_than
|
||||||
|
|
||||||
if (interval and older_than >= 1):
|
if (interval and older_than and older_than >= 1):
|
||||||
_periodic_task = periodic_task.periodic_task(
|
_periodic_task = periodic_task.periodic_task(
|
||||||
spacing=interval * 60,
|
spacing=interval * 60,
|
||||||
run_immediately=True
|
run_immediately=True
|
||||||
|
|
|
@ -51,7 +51,8 @@ class MistralPeriodicTasks(periodic_task.PeriodicTasks):
|
||||||
**t.workflow_params
|
**t.workflow_params
|
||||||
)
|
)
|
||||||
finally:
|
finally:
|
||||||
if t.remaining_executions > 0:
|
if (t.remaining_executions is not None and
|
||||||
|
t.remaining_executions > 0):
|
||||||
t.remaining_executions -= 1
|
t.remaining_executions -= 1
|
||||||
if t.remaining_executions == 0:
|
if t.remaining_executions == 0:
|
||||||
db_api_v2.delete_cron_trigger(t.name)
|
db_api_v2.delete_cron_trigger(t.name)
|
||||||
|
|
|
@ -45,7 +45,7 @@ def validate_cron_trigger_input(pattern, first_time, count):
|
||||||
raise exc.InvalidModelException(
|
raise exc.InvalidModelException(
|
||||||
'first_execution_time must be at least 1 second in the future.'
|
'first_execution_time must be at least 1 second in the future.'
|
||||||
)
|
)
|
||||||
if not pattern and count > 1:
|
if not pattern and count and count > 1:
|
||||||
raise exc.InvalidModelException(
|
raise exc.InvalidModelException(
|
||||||
'Pattern must be provided if count is superior to 1.'
|
'Pattern must be provided if count is superior to 1.'
|
||||||
)
|
)
|
||||||
|
|
|
@ -111,12 +111,13 @@ def get_indices_for_loop(task_ex):
|
||||||
def decrease_capacity(task_ex, count):
|
def decrease_capacity(task_ex, count):
|
||||||
with_items_context = _get_context(task_ex)
|
with_items_context = _get_context(task_ex)
|
||||||
|
|
||||||
if with_items_context[_CAPACITY] >= count:
|
if with_items_context[_CAPACITY] is not None:
|
||||||
with_items_context[_CAPACITY] -= count
|
if with_items_context[_CAPACITY] >= count:
|
||||||
elif with_items_context[_CAPACITY]:
|
with_items_context[_CAPACITY] -= count
|
||||||
raise exc.WorkflowException(
|
else:
|
||||||
"Impossible to apply current with-items concurrency."
|
raise exc.WorkflowException(
|
||||||
)
|
"Impossible to apply current with-items concurrency."
|
||||||
|
)
|
||||||
|
|
||||||
task_ex.runtime_context.update({_WITH_ITEMS: with_items_context})
|
task_ex.runtime_context.update({_WITH_ITEMS: with_items_context})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue