@@ -88,14 +88,6 @@ if [ "$(python /etc/sagemaker-ui/workflows/workflow_client.py check-blueprint -
8888 handle_workflows_startup_error 0
8989fi
9090
91- # Do minimum system requirements check: 4GB RAM and more than 2 CPU cores
92- free_mem=$( free -m | awk ' /^Mem:/ {print $7}' )
93- cpu_cores=$( nproc)
94- if [[ $free_mem -lt 4096 ]] || [[ $cpu_cores -le 2 ]]; then
95- echo " There is less than 4GB of available RAM or <=2 CPU cores. Workflows will not start. Free mem: $free_mem MB, CPU cores: $cpu_cores "
96- handle_workflows_startup_error 1
97- fi
98-
9991(
10092python /etc/sagemaker-ui/workflows/workflow_client.py update-local-runner-status --status ' starting' --detailed-status ' Creating directories'
10193
@@ -109,30 +101,12 @@ mkdir -p $WORKFLOW_STARTUP_PATH
109101mkdir -p $WORKFLOW_OUTPUT_PATH
110102) || handle_workflows_startup_error 2
111103
112- (
113- # Set the status of the status file to 'starting'
114- python /etc/sagemaker-ui/workflows/workflow_client.py update-local-runner-status --status ' starting' --detailed-status ' Installing prerequisites'
115-
116- # Workflows execution environment install
117- sudo apt-get update
118- sudo install -m 0755 -d /etc/apt/keyrings
119- sudo rm -f /etc/apt/keyrings/docker.gpg
120- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
121- sudo chmod a+r /etc/apt/keyrings/docker.gpg
122- echo \
123- " deb [arch=" $( dpkg --print-architecture) " signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
124- " $( . /etc/os-release && echo " $VERSION_CODENAME " ) " stable" | \
125- sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
126- sudo apt-get update
127- VERSION_ID=$( cat /etc/os-release | grep -oP ' VERSION_ID=".*"' | cut -d' "' -f2)
128- VERSION_STRING=$( sudo apt-cache madison docker-ce | awk ' { print $3 }' | grep -i $VERSION_ID | head -n 1)
129- sudo apt-get install docker-ce-cli=$VERSION_STRING docker-compose-plugin=2.29.2-1~ubuntu.22.04~jammy -y --allow-downgrades
130- ) || handle_workflows_startup_error 3
131104
132105(
133106# Set status to copying files
134107python /etc/sagemaker-ui/workflows/workflow_client.py update-local-runner-status --status ' starting' --detailed-status ' Copying files'
135108
109+ # Set up config files(plugins, requirements file, startup script), integrate with user custom setups
136110# Create .airflowignore file
137111cat >> " $WORKFLOW_DAG_PATH /.airflowignore" << 'END '
138112.ipynb_checkpoints
@@ -174,15 +148,42 @@ if [ -d $USER_PLUGINS_FOLDER ]; then
174148 cp -r $USER_PLUGINS_FOLDER /* $WORKFLOW_PLUGINS_PATH
175149fi
176150
151+ # Copy sample dag if it does not exist
152+ cp -n " /etc/sagemaker-ui/workflows/sample_dag.py" " ${WORKFLOW_DAG_PATH} /"
177153) || handle_workflows_startup_error 4
178154
155+ # Original logics for starting up workflows local runner
156+ # Do minimum system requirements check: 4GB RAM and more than 2 CPU cores
157+ free_mem=$( free -m | awk ' /^Mem:/ {print $7}' )
158+ cpu_cores=$( nproc)
159+ if [[ $free_mem -lt 4096 ]] || [[ $cpu_cores -le 2 ]]; then
160+ echo " There is less than 4GB of available RAM or <=2 CPU cores. Workflows will not start. Free mem: $free_mem MB, CPU cores: $cpu_cores "
161+ handle_workflows_startup_error 1
162+ fi
163+
164+ (
165+ python /etc/sagemaker-ui/workflows/workflow_client.py update-local-runner-status --status ' starting' --detailed-status ' Installing prerequisites'
166+
167+ # Workflows execution environment install
168+ sudo apt-get update
169+ sudo install -m 0755 -d /etc/apt/keyrings
170+ sudo rm -f /etc/apt/keyrings/docker.gpg
171+ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
172+ sudo chmod a+r /etc/apt/keyrings/docker.gpg
173+ echo \
174+ " deb [arch=" $( dpkg --print-architecture) " signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
175+ " $( . /etc/os-release && echo " $VERSION_CODENAME " ) " stable" | \
176+ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
177+ sudo apt-get update
178+ VERSION_ID=$( cat /etc/os-release | grep -oP ' VERSION_ID=".*"' | cut -d' "' -f2)
179+ VERSION_STRING=$( sudo apt-cache madison docker-ce | awk ' { print $3 }' | grep -i $VERSION_ID | head -n 1)
180+ sudo apt-get install docker-ce-cli=$VERSION_STRING docker-compose-plugin=2.29.2-1~ubuntu.22.04~jammy -y --allow-downgrades
181+ ) || handle_workflows_startup_error 3
182+
179183(
180184# Set status to installing workflows image
181185python /etc/sagemaker-ui/workflows/workflow_client.py update-local-runner-status --status ' starting' --detailed-status ' Installing workflows image'
182186
183- # Copy sample dag if it does not exist
184- cp -n " /etc/sagemaker-ui/workflows/sample_dag.py" " ${WORKFLOW_DAG_PATH} /"
185-
186187# Log into ECR repository
187188aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${ECR_ACCOUNT_ID} .dkr.ecr.${AWS_REGION} .amazonaws.com
188189
@@ -203,4 +204,4 @@ python /etc/sagemaker-ui/workflows/workflow_client.py update-local-runner-status
203204
204205# Start healthchecker
205206sleep 30 # give the container some time to start
206- supervisorctl -s unix:///var/run/supervisord/supervisor.sock start workflows_healthcheck
207+ supervisorctl -s unix:///var/run/supervisord/supervisor.sock start workflows_healthcheck
0 commit comments