Completed
Push — master ( bb5487...4fc1d0 )
by Manas
13:01 queued 05:18
created

get_logger()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 2
rs 10
cc 1
1
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
2
# contributor license agreements.  See the NOTICE file distributed with
3
# this work for additional information regarding copyright ownership.
4
# The ASF licenses this file to You under the Apache License, Version 2.0
5
# (the "License"); you may not use this file except in compliance with
6
# the License.  You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
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 implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
16
from st2common.content import utils
17
from st2common import log as logging
18
19
LOG = logging.getLogger(__name__)
20
STDOUT = 'stdout'
21
STDERR = 'stderr'
22
23
24
class RunnerContainerService(object):
25
    """
26
        The RunnerContainerService class implements the interface
27
        that ActionRunner implementations use to access services
28
        provided by the Action Runner Container.
29
    """
30
31
    def __init__(self):
32
        self._status = None
33
        self._result = None
34
        self._payload = {}
35
36
    def report_payload(self, name, value):
37
        self._payload[name] = value
38
39
    def get_logger(self, name):
40
        logging.getLogger(__name__ + '.' + name)
41
42
    @staticmethod
43
    def get_pack_base_path(pack_name):
44
        return utils.get_pack_base_path(pack_name)
45
46
    @staticmethod
47
    def get_entry_point_abs_path(pack=None, entry_point=None):
48
        return utils.get_entry_point_abs_path(pack, entry_point)
49
50
    @staticmethod
51
    def get_action_libs_abs_path(pack=None, entry_point=None):
52
        return utils.get_action_libs_abs_path(pack, entry_point)
53
54
    def __str__(self):
55
        result = []
56
        result.append('RunnerContainerService@')
57
        result.append(str(id(self)))
58
        result.append('(')
59
        result.append('_result="%s", ' % self._result)
60
        result.append('_payload="%s", ' % self._payload)
61
        result.append(')')
62
        return ''.join(result)
63