1 #######################################################################################
2 # Copyright ETSI Contributors and Others.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #######################################################################################
18 from dataclasses
import dataclass
20 from osm_common
.dbbase
import DbBase
21 from osm_common
.temporal
.activities
.base
import BaseActivity
22 from osm_common
.temporal
.states
import LcmOperationState
25 class NsLcmNoOp(BaseActivity
):
27 This is a simple No Operation Activity that simply logs the data
28 with which it was called. It can be used as a placeholder when
29 developing workflows, or can be enhanced with logic to throw
30 exceptions on specific conditions to test exception handling in
37 Input dataclass for workflows that run as LCM operations.
43 A dictionary representing the nslcmop record from the
49 async def __call__(self
, activity_input
: Input
) -> None:
50 raise NotImplementedError()
53 class UpdateNsLcmOperationState(BaseActivity
):
55 Changes the state of a LCM operation task. Should be done to
56 indicate progress, or completion of the task itself.
62 DbException If the target DB record does not exist or DB is not reachable.
65 This activity will not report a heartbeat due to its
67 As this is a direct DB update, it is not recommended to have
68 any specific retry policy
74 Input dataclass for updating LCM Operations in the Mongo nslcmops
75 collection. The following attributes will be updated automatically
82 The operation (task) id for this activity. This is the key
83 to the record in nslcmops collection that will be updated.
85 op_state : LcmOperationState
86 A representation of the state of the specified operation id,
87 such as PROCESSING, COMPLETED, or FAILED.
90 Human readable checkpoint message, intended only to give the
94 Human readable error message if any failure occurred.
97 Human readable message providing additional details to the
98 operation state, such as the error message explaining why
103 op_state
: LcmOperationState
108 def __init__(self
, db
: DbBase
):
112 async def __call__(self
, activity_input
: Input
) -> None:
113 raise NotImplementedError()