From 24d5c800ff39690d0b07a9e402902b0c1518ca65 Mon Sep 17 00:00:00 2001 From: tangwei Date: Thu, 14 May 2020 10:53:43 +0800 Subject: [PATCH] add paddle cloud run --- core/engine/cluster/cluster.py | 6 +++- core/engine/cluster/master.sh | 55 ---------------------------------- 2 files changed, 5 insertions(+), 56 deletions(-) delete mode 100644 core/engine/cluster/master.sh diff --git a/core/engine/cluster/cluster.py b/core/engine/cluster/cluster.py index 0143d73e..ae5703f1 100644 --- a/core/engine/cluster/cluster.py +++ b/core/engine/cluster/cluster.py @@ -28,7 +28,11 @@ from paddlerec.core.utils import envs class ClusterEngine(Engine): def __init_impl__(self): abs_dir = os.path.dirname(os.path.abspath(__file__)) - self.submit_script = os.path.join(abs_dir, "master.sh") + backend = envs.get_runtime_environ("engine_backend") + if backend == "PaddleCloud": + self.submit_script = os.path.join(abs_dir, "cloud/cluster.sh") + else: + raise ValueError("{} can not supported now".format(backend)) def start_worker_procs(self): trainer = TrainerFactory.create(self.trainer) diff --git a/core/engine/cluster/master.sh b/core/engine/cluster/master.sh deleted file mode 100644 index 47db5852..00000000 --- a/core/engine/cluster/master.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -################################################### -# Usage: submit.sh -# Description: run mpi submit clinet -################################################### - -# ---------------------------------------------------------------------------- # -# variable define # -# ---------------------------------------------------------------------------- # -declare g_curPath="" -declare g_scriptName="" -declare g_workPath="" -declare g_run_stage="" - -# ---------------------------------------------------------------------------- # -# const define # -# ---------------------------------------------------------------------------- # -declare -r CALL="x" -################################################################################ - -#----------------------------------------------------------------------------------------------------------------- -# Function: get_cur_path -# Description: get churrent path -# Parameter: -# input: -# N/A -# output: -# N/A -# Return: 0 -- success; not 0 -- failure -# Others: N/A -#----------------------------------------------------------------------------------------------------------------- -get_cur_path() { - g_run_stage="get_cur_path" - cd "$(dirname "${BASH_SOURCE-$0}")" - g_curPath="${PWD}" - g_scriptName="$(basename "${BASH_SOURCE-$0}")" - cd - >/dev/null -} - -#----------------------------------------------------------------------------------------------------------------- -#fun : check function return code -#param : N/A -#return : 0 -- success; not 0 -- failure -#----------------------------------------------------------------------------------------------------------------- -function check_error() { - if [ ${?} -ne 0 ]; then - echo "execute " + $g_run_stage + " raise exception! please check ..." - exit 1 - fi -} - -source ${engine_submit_scrpit} - -main -- GitLab