Пример #1
0
import csv
import datetime
import os
import socket
import threading
import warnings

from mms.log import get_logger

try:
    import boto3 as boto
except ImportError:
    boto = None

logger = get_logger()

MetricUnit = {
    'ms': "Milliseconds",
    'percent': 'Percent',
    'count': 'Count',
    'MB': 'Megabytes',
    'GB': 'Gigabytes'
}


class Metric(object):
    """Metric class for model server
    """

    def __init__(self, name, mutex,
Пример #2
0
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#     http://www.apache.org/licenses/LICENSE-2.0
# or in the "license" file accompanying this file. This file 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 json
import os
import subprocess

from mms.log import get_logger

logger = get_logger()


class ClientSDKGenerator(object):
    """Client SDK Generator using Swagger codegen tool
    """
    @staticmethod
    def generate(openapi_endpoints, sdk_lanugage):
        """Generate client sdk by given OpenAPI specification and target language.

        Parameters
        ----------
        openapi_endpoints : dict
            OpenAPI format api definition
        sdk_lanugage : string
            Target language for client sdk
Пример #3
0
import json
import os
import subprocess

from mms.log import get_logger

logger = get_logger(__name__)


class ClientSDKGenerator(object):
    '''Client SDK Generator using Swagger codegen tool
    '''
    @staticmethod
    def generate(openapi_endpoints, sdk_lanugage):
        '''Generate client sdk by given OpenAPI specification and target language.

        Parameters
        ----------
        openapi_endpoints : dict
            OpenAPI format api definition
        sdk_lanugage : string
            Target language for client sdk
        '''

        # Serialize OpenAPI definition to a file
        try:

            if not os.path.exists('build'):
                os.makedirs('build')
            f = open('build/openapi.json', 'w')
            json.dump(openapi_endpoints, f, indent=4)