Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
fix init container bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Binyang2014 committed Sep 17, 2019
1 parent 2092999 commit a0da0d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/kube-runtime/build/kube-runtime.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ COPY --from=builder ${INSTALL_DIR}/* ./runtime.d
RUN chmod -R +x ./


CMD ["/bin/sh", "-c", "LOG_DIR=/usr/local/pai/logs/${FC_POD_UID} && mkdir -p ${LOG_DIR} && /kube-runtime/src/init 2>&1 | tee ${LOG_DIR}/init.log"]
CMD ["/bin/sh", "-c", "set -o pipefail && LOG_DIR=/usr/local/pai/logs/${FC_POD_UID} && mkdir -p ${LOG_DIR} && /kube-runtime/src/init 2>&1 | tee ${LOG_DIR}/init.log"]
16 changes: 12 additions & 4 deletions src/kube-runtime/src/init
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ function exit_handler()
fi
fi

# signal triggered, do not change exit code
if [[ $EXIT_CODE -eq 130 || $EXIT_CODE -eq 131 || $EXIT_CODE -eq 132 || \
$EXIT_CODE -eq 134 || $EXIT_CODE -eq 135 || $EXIT_CODE -eq 136 || \
$EXIT_CODE -eq 137 || $EXIT_CODE -eq 139 || $EXIT_CODE -eq 141 || $EXIT_CODE -eq 143 ]]; then
exit $EXIT_CODE
fi

echo "Unknown exit code, platform error"
exit 1
}
Expand Down Expand Up @@ -84,7 +91,8 @@ cd ${PAI_WORK_DIR}

# comment for the script purpose
# priority=value
# ${PAI_INIT_DIR}/init.sh >> ${PAI_LOG_FILE} 2>&1
# CHILD_PROCESS="NAME_FOR_THE_INITIALIZER"
# ${PAI_INIT_DIR}/init.sh

# framework barrier
# priority=0
Expand All @@ -97,7 +105,7 @@ echo "barrier returns $?"
# priority=1
CHILD_PROCESS="ERROR_SPEC"
cp ${PAI_CONFIG_DIR}/runtime-exit-spec.yaml ${PAI_RUNTIME_DIR}
echo "copy exit spec returns $?" >> ${PAI_INIT_LOG_FILE}
echo "copy exit spec returns $?"

# generate runtime env variables
# priority=10
Expand All @@ -120,8 +128,8 @@ echo "initializer.py returns $?"
# Init plugins
# check port conflict
CHILD_PROCESS="PORT_CONFLICT_CHECKER"
python ${PAI_INIT_DIR}/port.py ${PAI_RUNTIME_DIR}/runtime_env.sh 2>> ${PAI_LOG_DIR}/initializer.log
echo "port.py.py returns $?" >> ${PAI_INIT_LOG_FILE}
python ${PAI_INIT_DIR}/port.py ${PAI_RUNTIME_DIR}/runtime_env.sh
echo "port.py.py returns $?"

# write user commands to user.sh
# priority=100
Expand Down

0 comments on commit a0da0d2

Please sign in to comment.