Skip to content

fix: allow Airflow enabled estimators to use absolute path entry_point #965

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/sagemaker/workflow/airflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ def prepare_framework(estimator, s3_operations):
code_dir = "s3://{}/{}".format(bucket, key)
estimator.uploaded_code = fw_utils.UploadedCode(s3_prefix=code_dir, script_name=script)
s3_operations["S3Upload"] = [
{"Path": estimator.source_dir or script, "Bucket": bucket, "Key": key, "Tar": True}
{
"Path": estimator.source_dir or estimator.entry_point,
"Bucket": bucket,
"Key": key,
"Tar": True,
}
]
estimator._hyperparameters[sagemaker.model.DIR_PARAM_NAME] = code_dir
estimator._hyperparameters[sagemaker.model.SCRIPT_PARAM_NAME] = script
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_airflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def test_byo_training_config_all_args(sagemaker_session):
@patch("sagemaker.utils.sagemaker_timestamp", MagicMock(return_value=TIME_STAMP))
def test_framework_training_config_required_args(sagemaker_session):
tf = tensorflow.TensorFlow(
entry_point="{{ entry_point }}",
entry_point="/some/script.py",
framework_version="1.10.0",
training_steps=1000,
evaluation_steps=100,
Expand Down Expand Up @@ -206,7 +206,7 @@ def test_framework_training_config_required_args(sagemaker_session):
"HyperParameters": {
"sagemaker_submit_directory": '"s3://output/sagemaker-tensorflow-%s/source/sourcedir.tar.gz"'
% TIME_STAMP,
"sagemaker_program": '"{{ entry_point }}"',
"sagemaker_program": '"script.py"',
"sagemaker_enable_cloudwatch_metrics": "false",
"sagemaker_container_log_level": "20",
"sagemaker_job_name": '"sagemaker-tensorflow-%s"' % TIME_STAMP,
Expand All @@ -219,7 +219,7 @@ def test_framework_training_config_required_args(sagemaker_session):
"S3Operations": {
"S3Upload": [
{
"Path": "{{ entry_point }}",
"Path": "/some/script.py",
"Bucket": "output",
"Key": "sagemaker-tensorflow-%s/source/sourcedir.tar.gz" % TIME_STAMP,
"Tar": True,
Expand Down