Exemplo n.º 1
0
    def _parse_parameter_file(self, parameter_file) -> Union[None, str]:

        _msg_parameter_file = ""
        if len(parameter_file) > 0:

            if not os.path.isfile(parameter_file):
                parameter_file = None
                _msg_parameter_file = "Can not find parameter file '{}'".format(
                    parameter_file)
            else:
                parameter_file = parameter_file

        # missing parameter file
        else:

            parameter_file = None
            _msg_parameter_file = "Parameter file missing. Consider specifying the path with the option '--parameter-file'."

        msg = self._msg_option.format("parameter-file", parameter_file)
        print(str_info(msg))
        self.logger.info(msg)

        if _msg_parameter_file:
            print(str_warn(_msg_parameter_file))
            self.logger.warn(_msg_parameter_file)

        return parameter_file
Exemplo n.º 2
0
    def _parse_config_file(self, config_file) -> Union[str, None]:

        _msg_config_file = ""
        if len(config_file) > 0:

            if not os.path.isfile(config_file):
                config_file = None
                _msg_config_file = "Can not find config file '{}'".format(
                    config_file)
            else:
                config_file = config_file

        # missing config file
        else:

            config_file = None
            _msg_config_file = "Config file missing. Consider specifying the path with the option '--config-file'."

        msg = self._msg_option.format("config-file", config_file)
        print(str_info(msg))
        self.logger.info(msg)

        if _msg_config_file:
            print(str_warn(_msg_config_file))
            self.logger.warn(_msg_config_file)

        return config_file
Exemplo n.º 3
0
        - 'python -m lasso.ansa.grpc.server --python33-path path/to/anaconda/envs/py33'

        Or set the environment variable 'ANSA_GRPC_SITE_PACKAGES_PATH'
        - csh : 'setenv ANSA_GRPC_SITE_PACKAGES_PATH path/to/anaconda/envs/py33'
        - bash: 'export ANSA_GRPC_SITE_PACKAGES_PATH="path/to/anaconda/envs/py33"'
        - ps  : '$env:ANSA_GRPC_SITE_PACKAGES_PATH = "path/to/anaconda/envs/py33"'
        - cmd : 'setx ANSA_GRPC_SITE_PACKAGES_PATH "path/to/anaconda/envs/py33"'

    (4) Enjoy life ♥
'''

# this is a utility for the command line usage
try:
    sys.path.append(os.environ["ANSA_GRPC_SITE_PACKAGES_PATH"])
except KeyError as err:
    print(str_warn(_msg_site_packages_dir_not_set.format(
        "ANSA_GRPC_SITE_PACKAGES_PATH")))

try:
    import AnsaGRPC_pb2
    import AnsaGRPC_pb2_grpc
    import grpc
    from utils import Entity, pickle_object
except ImportError as err:
    raise RuntimeError(str_error(_msg_import_error.format(str(err))))


def print_header():

    header = '''
    ANSA Remote Scripting Server by {0}
    ------------------------------------------