blob: 273bf0178f1acc015d4679bd298710ce43e1d172 [file] [log] [blame]
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
import logging
from osm_lcm.lcm_utils import LcmBase
class OduWorkflow(LcmBase):
def __init__(self, msg, lcm_tasks, config):
"""
Init, Connect to database, filesystem storage, and messaging
:param config: two level dictionary with configuration. Top level should contain 'database', 'storage',
:return: None
"""
self.logger = logging.getLogger("lcm.odu")
self.lcm_tasks = lcm_tasks
self.logger.info("Msg: {} lcm_tasks: {} ".format(msg, lcm_tasks))
super().__init__(msg, self.logger)
def launch_workflow(self, key, content):
self.logger.info(
f"Workflow is getting into launch. Key: {key}. Content: {content}"
)
return f"workflow-{key}-{content['_id']}"
def check_workflow_status(self, workflow_name):
self.logger.info(f"Check workflow status {workflow_name}")
return True, "OK"
def check_resource_status(self, key, content):
self.logger.info(f"Check resource status {key}: {content}")
return True, "OK"