Remove misplaced constants describing worklow task types

* These constants have nothing to do with this project. They should
  be in the 'mistral' repo.
* Minor style changes.

Change-Id: Ia3f50388638d68bbcc5e2e9e424ddb9dd65b26eb
This commit is contained in:
Renat Akhmerov 2020-06-04 18:26:45 +07:00
parent d137023727
commit d888fe240c
4 changed files with 9 additions and 6 deletions

View File

@ -35,9 +35,12 @@ class ActionContext(serialization.MistralSerializable):
"redelivered", "region_name", "service_catalog", "trust_id",
"user_name"
]
if name in deprecated:
self._deprecation_warning(name)
return getattr(self.security, name)
return super(ActionContext, self).__getattribute__(name)
@ -75,6 +78,7 @@ class ExecutionContext(object):
if task_id is not None:
self.task_execution_id = task_id
self._deprecate_task_id_warning()
def _deprecate_task_id_warning(self):
@ -87,6 +91,7 @@ class ExecutionContext(object):
@property
def task_id(self):
self._deprecate_task_id_warning()
return self.task_execution_id

View File

@ -35,6 +35,7 @@ class Result(serialization.MistralSerializable):
_data = utils.mask_data(self.data)
_error = utils.mask_data(self.error)
_cancel = utils.mask_data(self.cancel)
return 'Result [data=%s, error=%s, cancel=%s]' % (
utils.cut(_data), utils.cut(_error), str(_cancel)
)

View File

@ -37,15 +37,10 @@ from oslo_utils import uuidutils
import pkg_resources as pkg
import random
# Thread local storage.
_th_loc_storage = threading.local()
# TODO(rakhmerov): these two constants are misplaced. Utility methods
# should not be Mistral specific. They should be generic enough so to
# be moved to any other project w/o changes.
ACTION_TASK_TYPE = 'ACTION'
WORKFLOW_TASK_TYPE = 'WORKFLOW'
def generate_unicode_uuid():
return uuidutils.generate_uuid()
@ -96,6 +91,7 @@ def set_thread_local(var_name, val):
if val is not None:
gl_storage = _get_greenlet_local_storage()
if not gl_storage:
gl_storage = _th_loc_storage.greenlet_locals[
corolocal.get_ident()] = {}

View File

@ -26,6 +26,7 @@ def get_public_fields(obj):
for attribute_str in public_attributes:
attr = getattr(obj, attribute_str)
is_field = not (inspect.isbuiltin(attr) or
inspect.isfunction(attr) or
inspect.ismethod(attr) or