Merge "Enlarge tags support"

This commit is contained in:
Zuul 2019-12-09 08:40:38 +00:00 committed by Gerrit Code Review
commit 7e0c7c92b7
7 changed files with 65 additions and 25 deletions

View File

@ -3,6 +3,7 @@
# Copyright 2015 Huawei Technologies Co., Ltd. # Copyright 2015 Huawei Technologies Co., Ltd.
# Copyright 2016 - Brocade Communications Systems, Inc. # Copyright 2016 - Brocade Communications Systems, Inc.
# Copyright 2018 - Extreme Networks, Inc. # Copyright 2018 - Extreme Networks, Inc.
# Copyright 2019 - NetCracker Technology Corp.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -331,15 +332,18 @@ class ExecutionsController(rest.RestController):
@rest_utils.wrap_wsme_controller_exception @rest_utils.wrap_wsme_controller_exception
@wsme_pecan.wsexpose(resources.Executions, types.uuid, int, @wsme_pecan.wsexpose(resources.Executions, types.uuid, int,
types.uniquelist, types.list, types.uniquelist, types.uniquelist, types.list, types.uniquelist,
wtypes.text, types.uuid, wtypes.text, types.jsontype, wtypes.text, types.uuid, wtypes.text,
types.uuid, types.uuid, STATE_TYPES, wtypes.text, types.uniquelist, types.jsontype, types.uuid,
types.uuid, STATE_TYPES, wtypes.text,
types.jsontype, types.jsontype, wtypes.text, types.jsontype, types.jsontype, wtypes.text,
wtypes.text, bool, types.uuid, bool, types.list) wtypes.text, bool, types.uuid,
def get_all(self, marker=None, limit=None, sort_keys='created_at', bool, types.list)
sort_dirs='asc', fields='', workflow_name=None, def get_all(self, marker=None, limit=None,
workflow_id=None, description=None, params=None, sort_keys='created_at', sort_dirs='asc', fields='',
task_execution_id=None, root_execution_id=None, state=None, workflow_name=None, workflow_id=None, description=None,
state_info=None, input=None, output=None, created_at=None, tags=None, params=None, task_execution_id=None,
root_execution_id=None, state=None, state_info=None,
input=None, output=None, created_at=None,
updated_at=None, include_output=None, project_id=None, updated_at=None, include_output=None, project_id=None,
all_projects=False, nulls=''): all_projects=False, nulls=''):
@ -365,6 +369,7 @@ class ExecutionsController(rest.RestController):
workflow ID. workflow ID.
:param description: Optional. Keep only resources with a specific :param description: Optional. Keep only resources with a specific
description. description.
:param tags: Optional. Keep only resources containing specific tags.
:param params: Optional. Keep only resources with specific parameters. :param params: Optional. Keep only resources with specific parameters.
:param task_execution_id: Optional. Keep only resources with a :param task_execution_id: Optional. Keep only resources with a
specific task execution ID. specific task execution ID.
@ -400,6 +405,7 @@ class ExecutionsController(rest.RestController):
created_at=created_at, created_at=created_at,
workflow_name=workflow_name, workflow_name=workflow_name,
workflow_id=workflow_id, workflow_id=workflow_id,
tags=tags,
params=params, params=params,
task_execution_id=task_execution_id, task_execution_id=task_execution_id,
state=state, state=state,

View File

@ -1,5 +1,6 @@
# Copyright 2013 - Mirantis, Inc. # Copyright 2013 - Mirantis, Inc.
# Copyright 2018 - Extreme Networks, Inc. # Copyright 2018 - Extreme Networks, Inc.
# Copyright 2019 - NetCracker Technology Corp.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -271,6 +272,9 @@ class Execution(resource.Resource):
description = wtypes.text description = wtypes.text
"description of workflow execution" "description of workflow execution"
tags = [wtypes.text]
"tags of workflow execution"
params = types.jsontype params = types.jsontype
"""'params' define workflow type specific parameters. Specific parameters """'params' define workflow type specific parameters. Specific parameters
are: are:
@ -324,6 +328,7 @@ class Execution(resource.Resource):
workflow_namespace='some_namespace', workflow_namespace='some_namespace',
workflow_id='123e4567-e89b-12d3-a456-426655441111', workflow_id='123e4567-e89b-12d3-a456-426655441111',
description='this is the first execution.', description='this is the first execution.',
tags=['simple', 'amazing'],
project_id='40a908dbddfe48ad80a87fb30fa70a03', project_id='40a908dbddfe48ad80a87fb30fa70a03',
state='SUCCESS', state='SUCCESS',
input={}, input={},
@ -389,6 +394,8 @@ class Task(resource.Resource):
workflow_id = wtypes.text workflow_id = wtypes.text
workflow_execution_id = wtypes.text workflow_execution_id = wtypes.text
tags = [wtypes.text]
state = wtypes.text state = wtypes.text
"""state can take one of the following values: """state can take one of the following values:
IDLE, RUNNING, SUCCESS, ERROR, DELAYED""" IDLE, RUNNING, SUCCESS, ERROR, DELAYED"""
@ -423,6 +430,7 @@ class Task(resource.Resource):
workflow_name='flow', workflow_name='flow',
workflow_id='123e4567-e89b-12d3-a456-426655441111', workflow_id='123e4567-e89b-12d3-a456-426655441111',
workflow_execution_id='123e4567-e89b-12d3-a456-426655440000', workflow_execution_id='123e4567-e89b-12d3-a456-426655440000',
tags=['long', 'security'],
name='task', name='task',
state=states.SUCCESS, state=states.SUCCESS,
project_id='40a908dbddfe48ad80a87fb30fa70a03', project_id='40a908dbddfe48ad80a87fb30fa70a03',

View File

@ -1,5 +1,6 @@
# Copyright 2013 - Mirantis, Inc. # Copyright 2013 - Mirantis, Inc.
# Copyright 2015 - StackStorm, Inc. # Copyright 2015 - StackStorm, Inc.
# Copyright 2019 - NetCracker Technology Corp.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -114,14 +115,16 @@ class TaskExecutionsController(rest.RestController):
@rest_utils.wrap_wsme_controller_exception @rest_utils.wrap_wsme_controller_exception
@wsme_pecan.wsexpose(resources.Executions, types.uuid, types.uuid, int, @wsme_pecan.wsexpose(resources.Executions, types.uuid, types.uuid, int,
types.uniquelist, types.list, types.uniquelist, types.uniquelist, types.list, types.uniquelist,
wtypes.text, types.uuid, wtypes.text, types.jsontype, wtypes.text, types.uuid, wtypes.text,
STATE_TYPES, wtypes.text, types.jsontype, types.uniquelist, types.jsontype, STATE_TYPES,
types.jsontype, wtypes.text, wtypes.text) wtypes.text, types.jsontype, types.jsontype,
wtypes.text, wtypes.text)
def get_all(self, task_execution_id, marker=None, limit=None, def get_all(self, task_execution_id, marker=None, limit=None,
sort_keys='created_at', sort_dirs='asc', fields='', sort_keys='created_at', sort_dirs='asc', fields='',
workflow_name=None, workflow_id=None, description=None, workflow_name=None, workflow_id=None, description=None,
params=None, state=None, state_info=None, input=None, tags=None, params=None, state=None,
output=None, created_at=None, updated_at=None): state_info=None, input=None, output=None,
created_at=None, updated_at=None):
"""Return all executions that belong to the given task execution. """Return all executions that belong to the given task execution.
:param task_execution_id: Task task execution ID. :param task_execution_id: Task task execution ID.
@ -145,6 +148,7 @@ class TaskExecutionsController(rest.RestController):
workflow ID. workflow ID.
:param description: Optional. Keep only resources with a specific :param description: Optional. Keep only resources with a specific
description. description.
:param tags: Optional. Keep only resources containing specific tags.
:param params: Optional. Keep only resources with specific parameters. :param params: Optional. Keep only resources with specific parameters.
:param state: Optional. Keep only resources with a specific state. :param state: Optional. Keep only resources with a specific state.
:param state_info: Optional. Keep only resources with specific :param state_info: Optional. Keep only resources with specific
@ -163,6 +167,7 @@ class TaskExecutionsController(rest.RestController):
created_at=created_at, created_at=created_at,
workflow_name=workflow_name, workflow_name=workflow_name,
workflow_id=workflow_id, workflow_id=workflow_id,
tags=tags,
params=params, params=params,
state=state, state=state,
state_info=state_info, state_info=state_info,
@ -213,14 +218,18 @@ class TasksController(rest.RestController):
@rest_utils.wrap_wsme_controller_exception @rest_utils.wrap_wsme_controller_exception
@wsme_pecan.wsexpose(resources.Tasks, types.uuid, int, types.uniquelist, @wsme_pecan.wsexpose(resources.Tasks, types.uuid, int, types.uniquelist,
types.list, types.uniquelist, wtypes.text, types.list, types.uniquelist, wtypes.text,
wtypes.text, types.uuid, types.uuid, STATE_TYPES, wtypes.text, types.uuid,
wtypes.text, wtypes.text, types.jsontype, bool, types.uuid, types.uniquelist, STATE_TYPES,
wtypes.text, wtypes.text, bool, types.jsontype) wtypes.text, wtypes.text, types.jsontype,
bool, wtypes.text, wtypes.text,
bool, types.jsontype)
def get_all(self, marker=None, limit=None, sort_keys='created_at', def get_all(self, marker=None, limit=None, sort_keys='created_at',
sort_dirs='asc', fields='', name=None, workflow_name=None, sort_dirs='asc', fields='', name=None,
workflow_id=None, workflow_execution_id=None, state=None, workflow_name=None, workflow_id=None,
state_info=None, result=None, published=None, processed=None, workflow_execution_id=None, tags=None, state=None,
created_at=None, updated_at=None, reset=None, env=None): state_info=None, result=None, published=None,
processed=None, created_at=None, updated_at=None,
reset=None, env=None):
"""Return all tasks. """Return all tasks.
Where project_id is the same as the requester or Where project_id is the same as the requester or
@ -269,6 +278,7 @@ class TasksController(rest.RestController):
created_at=created_at, created_at=created_at,
workflow_name=workflow_name, workflow_name=workflow_name,
workflow_id=workflow_id, workflow_id=workflow_id,
tags=tags,
state=state, state=state,
state_info=state_info, state_info=state_info,
updated_at=updated_at, updated_at=updated_at,
@ -373,13 +383,15 @@ class ExecutionTasksController(rest.RestController):
@rest_utils.wrap_wsme_controller_exception @rest_utils.wrap_wsme_controller_exception
@wsme_pecan.wsexpose(resources.Tasks, types.uuid, types.uuid, int, @wsme_pecan.wsexpose(resources.Tasks, types.uuid, types.uuid, int,
types.uniquelist, types.list, types.uniquelist, types.uniquelist, types.list, types.uniquelist,
wtypes.text, wtypes.text, types.uuid, STATE_TYPES, wtypes.text, wtypes.text, types.uuid,
wtypes.text, wtypes.text, types.jsontype, bool, types.uniquelist, STATE_TYPES, wtypes.text,
wtypes.text, types.jsontype, bool,
wtypes.text, wtypes.text, bool, types.jsontype) wtypes.text, wtypes.text, bool, types.jsontype)
def get_all(self, workflow_execution_id, marker=None, limit=None, def get_all(self, workflow_execution_id, marker=None, limit=None,
sort_keys='created_at', sort_dirs='asc', fields='', name=None, sort_keys='created_at', sort_dirs='asc', fields='',
workflow_name=None, workflow_id=None, state=None, name=None, workflow_name=None, workflow_id=None,
state_info=None, result=None, published=None, processed=None, tags=None, state=None, state_info=None,
result=None, published=None, processed=None,
created_at=None, updated_at=None, reset=None, env=None): created_at=None, updated_at=None, reset=None, env=None):
"""Return all tasks within the execution. """Return all tasks within the execution.
@ -407,6 +419,7 @@ class ExecutionTasksController(rest.RestController):
workflow ID. workflow ID.
:param workflow_execution_id: Optional. Keep only resources with a :param workflow_execution_id: Optional. Keep only resources with a
specific workflow execution ID. specific workflow execution ID.
:param tags: Optional. Keep only resources containing specific tags.
:param state: Optional. Keep only resources with a specific state. :param state: Optional. Keep only resources with a specific state.
:param state_info: Optional. Keep only resources with specific :param state_info: Optional. Keep only resources with specific
state information. state information.
@ -430,6 +443,7 @@ class ExecutionTasksController(rest.RestController):
created_at=created_at, created_at=created_at,
workflow_name=workflow_name, workflow_name=workflow_name,
workflow_id=workflow_id, workflow_id=workflow_id,
tags=tags,
state=state, state=state,
state_info=state_info, state_info=state_info,
updated_at=updated_at, updated_at=updated_at,

View File

@ -1,6 +1,7 @@
# Copyright 2016 - Nokia Networks. # Copyright 2016 - Nokia Networks.
# Copyright 2016 - Brocade Communications Systems, Inc. # Copyright 2016 - Brocade Communications Systems, Inc.
# Copyright 2018 - Extreme Networks, Inc. # Copyright 2018 - Extreme Networks, Inc.
# Copyright 2019 - NetCracker Technology Corp.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -403,6 +404,7 @@ class Task(object):
task_id = utils.generate_unicode_uuid() task_id = utils.generate_unicode_uuid()
task_name = self.task_spec.get_name() task_name = self.task_spec.get_name()
task_type = self.task_spec.get_type() task_type = self.task_spec.get_type()
task_tags = self.task_spec.get_tags()
values = { values = {
'id': task_id, 'id': task_id,
@ -411,6 +413,7 @@ class Task(object):
'workflow_name': self.wf_ex.workflow_name, 'workflow_name': self.wf_ex.workflow_name,
'workflow_namespace': self.wf_ex.workflow_namespace, 'workflow_namespace': self.wf_ex.workflow_namespace,
'workflow_id': self.wf_ex.workflow_id, 'workflow_id': self.wf_ex.workflow_id,
'tags': task_tags,
'state': state, 'state': state,
'state_info': state_info, 'state_info': state_info,
'spec': self.task_spec.to_dict(), 'spec': self.task_spec.to_dict(),

View File

@ -1,6 +1,7 @@
# Copyright 2016 - Nokia Networks. # Copyright 2016 - Nokia Networks.
# Copyright 2016 - Brocade Communications Systems, Inc. # Copyright 2016 - Brocade Communications Systems, Inc.
# Copyright 2018 - Extreme Networks, Inc. # Copyright 2018 - Extreme Networks, Inc.
# Copyright 2019 - NetCracker Technology Corp.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -356,6 +357,7 @@ class Workflow(object):
'id': wf_ex_id, 'id': wf_ex_id,
'name': wf_def.name, 'name': wf_def.name,
'description': desc, 'description': desc,
'tags': wf_def.tags,
'workflow_name': wf_def.name, 'workflow_name': wf_def.name,
'workflow_namespace': wf_def.namespace, 'workflow_namespace': wf_def.namespace,
'workflow_id': wf_def.id, 'workflow_id': wf_def.id,

View File

@ -1,5 +1,6 @@
# Copyright 2014 - Mirantis, Inc. # Copyright 2014 - Mirantis, Inc.
# Copyright 2015 - StackStorm, Inc. # Copyright 2015 - StackStorm, Inc.
# Copyright 2019 - NetCracker Technology Corp.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -110,6 +111,7 @@ class TaskSpec(base.BaseSpec):
self._description = data.get('description') self._description = data.get('description')
self._action = data.get('action') self._action = data.get('action')
self._workflow = data.get('workflow') self._workflow = data.get('workflow')
self._tags = data.get('tags', [])
self._input = data.get('input', {}) self._input = data.get('input', {})
self._with_items = self._transform_with_items() self._with_items = self._transform_with_items()
self._publish = data.get('publish', {}) self._publish = data.get('publish', {})
@ -223,6 +225,9 @@ class TaskSpec(base.BaseSpec):
def get_workflow_name(self): def get_workflow_name(self):
return self._workflow return self._workflow
def get_tags(self):
return self._tags
def get_input(self): def get_input(self):
return self._input return self._input

View File

@ -1,5 +1,6 @@
# Copyright 2013 - Mirantis, Inc. # Copyright 2013 - Mirantis, Inc.
# Copyright 2015 - StackStorm, Inc. # Copyright 2015 - StackStorm, Inc.
# Copyright 2019 - NetCracker Technology Corp.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -109,6 +110,7 @@ TASK = {
'name': 'task', 'name': 'task',
'workflow_name': 'flow', 'workflow_name': 'flow',
'workflow_id': '123e4567-e89b-12d3-a456-426655441111', 'workflow_id': '123e4567-e89b-12d3-a456-426655441111',
'tags': ['a', 'b'],
'state': 'RUNNING', 'state': 'RUNNING',
'workflow_execution_id': WF_EX.id, 'workflow_execution_id': WF_EX.id,
'created_at': '1970-01-01 00:00:00', 'created_at': '1970-01-01 00:00:00',