Skip to content

AWS sagemaker issue on ML flow pipeline ins EC2 Linux

0

Hi Team,

ML flow code not able create or delete Temp folder while deploying pipeline code in AWS EC2 Linux instance.

sample python code:

from sagemaker.workflow.pipeline import Pipeline from sagemaker.workflow.pipeline_context import PipelineSession from sagemaker.workflow.execution_variables import ExecutionVariables from sagemaker.workflow.function_step import step from sagemaker.workflow.parameters import ParameterString from sagemaker import get_execution_role

os.environ["SAGEMAKER_USER_CONFIG_OVERRIDE"] = "config.yaml" pipeline_session = PipelineSession()

preprocessing step creation

preprocess_step = step(preprocess, name=preprocess_name)( headers, data, mlflow_arn, experiment_name, run_name= ExecutionVariables.PIPELINE_EXECUTION_ID, job_name = ExecutionVariables.TRAINING_JOB_NAME )

pipeline = Pipeline( name=pipeline_name, steps=[preprocess_step], #finetune_step, evaluation_step, create_model_step, register_step], # parameters=[lora_config], sagemaker_session=pipeline_session )

below steps are running fine till Successfully uploaded dependencies

sagemaker.config INFO - Applied value from config key = SageMaker.PythonSDK.Modules.RemoteFunction.RoleArn INFO:werkzeug:127.0.0.1 - - [19/Mar/2025 12:34:24] "POST /ilf2024/aimicrolab/inspire-pip-svc/pipeline_logs HTTP/1.1" 500 - 2025-03-19 07:04:28,481 sagemaker.remote_function INFO Uploading serialized function code to s3://sagemaker-us-east-1-211125423464/finetuning-pipeline/preprocess-TRJ000013/2025-03-19-07-04-20-861/function 2025-03-19 07:04:29,521 sagemaker.remote_function INFO Uploading serialized function arguments to s3://sagemaker-us-east-1-211125423464/finetuning-pipeline/preprocess-TRJ000013/2025-03-19-07-04-20-861/arguments 2025-03-19 07:04:32,746 sagemaker.remote_function INFO Copied dependencies file at './requirements.txt' to 'C:\Users\10746692\AppData\Local\Temp\tmp__5tf5li\requirements.txt' 2025-03-19 07:04:33,454 sagemaker.remote_function INFO Successfully uploaded dependencies and pre execution scripts to 's3://sagemaker-us-east-1-211125423464/finetuning-pipeline/preprocess-TRJ000013/2025-03-19-07-04-20-861/pre_exec_script_and_dependencies'

below steps are not running and code got frozen above steps itself.

2025-03-19 07:04:33,501 sagemaker.remote_function INFO Copied user workspace to 'C:\Users\10746692\AppData\Local\Temp\tmp6xi71ole\temp_workspace/sagemaker_remote_function_workspace' 2025-03-19 07:04:33,859 sagemaker.remote_function INFO Successfully created workdir archive at 'C:\Users\10746692\AppData\Local\Temp\tmp6xi71ole\workspace.zip' 2025-03-19 07:04:43,311 sagemaker.remote_function INFO Successfully uploaded workdir to 's3://sagemaker-us-east-1-211125423464/finetuning-pipeline/sm_rf_user_ws/2025-03-19-07-04-20-861/workspace.zip' WARNING:sagemaker.workflow.utilities:Popping out 'TrainingJobName' from the pipeline definition by default since it will be overridden at pipeline execution time. Please utilize the PipelineDefinitionConfig to persist this field in the pipeline definition if desired.

please what steps should take to run the code.

1 Answer
0

Based on the information provided, it appears you're encountering an issue with your SageMaker pipeline execution on an EC2 Linux instance. The problem seems to be related to file system permissions or temporary folder creation/deletion. Here are some steps you can take to troubleshoot and potentially resolve the issue:

  1. Check permissions: Ensure that the IAM role associated with your EC2 instance and SageMaker execution role have the necessary permissions to create and delete temporary folders, as well as access S3 buckets.

  2. Verify available disk space: Make sure your EC2 instance has sufficient disk space for creating temporary folders and processing data.

  3. Use absolute paths: Instead of relying on relative paths, try using absolute paths for any file operations in your code.

  4. Set environment variables: Explicitly set the TMPDIR environment variable to a location where your process has write permissions.

  5. Update SageMaker SDK: Ensure you're using the latest version of the SageMaker SDK, as newer versions may have bug fixes for issues like this.

  6. Check CloudWatch logs: Review the CloudWatch logs for your SageMaker jobs to see if there are any specific error messages that can provide more insight into the issue.

  7. Use a custom Docker image: If the issue persists, consider creating a custom Docker image with the necessary permissions and configurations for your pipeline.

  8. Implement error handling: Add try-except blocks in your code to catch and log any specific exceptions that might be occurring during the temporary folder operations.

  9. Review SageMaker quotas: Ensure you haven't reached any SageMaker service quotas that might be preventing your pipeline from executing properly.

If these steps don't resolve the issue, you may need to contact AWS support for further assistance, as there could be account-specific or region-specific factors affecting your pipeline execution.
Sources
Troubleshooting Amazon SageMaker Pipelines - Amazon SageMaker AI
Amazon SageMaker AI MLOps troubleshooting - Amazon SageMaker AI
Add a step - Amazon SageMaker AI

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.