コード例 #1
0
def get_variable_value(variable_name):
    Logger.log_task_event(GENERATE_INPUTS_TASK, "Getting value of: {}".format(variable_name))

    if not os.environ.get(variable_name):
        return

    variable_value = os.environ.get(env_key)
    if VARIABLE_DELIMITER in variable_value:
        variable_value = [x for x in variable_value.split(VARIABLE_DELIMITER) if x]

    Logger.log_task_event(GENERATE_INPUTS_TASK, "Value of {}:\n{}".format(variable_name, variable_value))

    return variable_value
コード例 #2
0
ファイル: nodeup.py プロジェクト: ymjyyjyz/cloud-pipeline
def pipe_log(message, status=TaskStatus.RUNNING):
    global api_token
    global api_url
    global script_path
    global current_run_id

    if api_url and api_token:
        Logger.log_task_event(NODEUP_TASK,
                              '[{}] {}'.format(current_run_id, message),
                              run_id=current_run_id,
                              instance=str(current_run_id),
                              log_dir=script_path,
                              api_url=api_url,
                              status=status,
                              omit_console=True)
    else:
        # Log as always
        logging.info(message)
コード例 #3
0
# Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/)
#
# 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.

from pipeline import Logger, TaskStatus
Logger.log_task_event("Task1",
                      "Running python pipeline",
                      status=TaskStatus.SUCCESS)
コード例 #4
0
inputs_json_file = None

if len(sys.argv) == 1:
    raise Exception('WDL file path shall be specified')

wdl_file = sys.argv[1]

if len(sys.argv) > 2:
    inputs_json_file = sys.argv[2]

if not os.path.isfile(wdl_file):
    raise Exception('WDL file not found: {}'.format(wdl_file))

if inputs_json_file:
    Logger.log_task_event(GENERATE_INPUTS_TASK, "inputs.json file is specified explicitly {}".format(inputs_json_file))
    try:
        input_json_content = None
        with open(inputs_json_file, 'r') as input_json:
            input_json_content = input_json.read()

        Logger.log_task_event(GENERATE_INPUTS_TASK, '{} file contents"\n{}'.format(inputs_json_file, input_json_content), status=TaskStatus.SUCCESS)
    except Exception as e:
        Logger.log_task_event(GENERATE_INPUTS_TASK, str(e), status=TaskStatus.FAILURE)
        exit(1)
else:
    Logger.log_task_event(GENERATE_INPUTS_TASK, "Generating WDL inputs.json from {}".format(wdl_file))

    try:

        subprocess.check_output('java -jar /wdltool_bin/wdltool.jar inputs {} > inputs.json'.format(wdl_file), shell=True)