Skip to content
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

[Component] Add Managed Spot Training Support for SageMaker #2219

Merged
merged 4 commits into from
Oct 3, 2019
Merged

[Component] Add Managed Spot Training Support for SageMaker #2219

merged 4 commits into from
Oct 3, 2019

Conversation

RedbackThomson
Copy link
Contributor

@RedbackThomson RedbackThomson commented Sep 24, 2019

Adds the ability to enable managed spot training as a configuration option for the Sagemaker component.

Added unit tests for the new feature as can be found in the tests/ folder in root.


This change is Reviewable

@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@k8s-ci-robot
Copy link
Contributor

Hi @RedbackThomson. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@RedbackThomson
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link
Collaborator

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@RedbackThomson
Copy link
Contributor Author

/assign @Jeffwan

@RedbackThomson
Copy link
Contributor Author

Still need to upload and edit the new container into the configuration. Not ready to merge yet.

@Jeffwan
Copy link
Member

Jeffwan commented Sep 24, 2019

@RedbackThomson Could you make sure the interface changes are included in samples/contribute/aws/ ?

default: '86400'
- name: checkpoint_config
description: 'Dictionary of information about the output location for managed spot training checkpoint data.'
default: '{}'
Copy link
Contributor

@Ark-kun Ark-kun Sep 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JFYI: The recent SDK (0.1.29+) supports the JsonObject type. Constant list arguments passed to type: JsonObject inputs will be serialized as JSON.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this update support nicer/easier input in the UI for JSON fields?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet. For now it only works for constant lists passed to components. The auto-conversion does not work in UX or when passing arguments to pipeline during the submission.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this will only work for this case:

aws_sagemaker_trainop(..., checkpoint_config={'a' = 1, 'b' = 1},...)

Previously this would have just resulted in some wrong string (produced by str()) being passed. Now it would be json.dumps-serialized string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great addition. Is there any way to suppress the warning that dsl-compile throws when it infers the JsonObject type?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to suppress the warning that dsl-compile throws when it infers the JsonObject type?

The warning is shown every time a non-string argument is passed to an untyped input.
The easiest way to make it go away is to add the type to the input. Then there would be no inference.

Copy link
Contributor Author

@RedbackThomson RedbackThomson Sep 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The easiest way to make it go away is to add the type to the input.

Through explicit cast?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Through explicit cast?

No. Just add the type attribute to the input annotation:

  - name: checkpoint_config
    type: JsonObject
    description: 'Dictionary of information about the output location for managed spot training checkpoint data.'
    default: '{}'

@Jeffwan
Copy link
Member

Jeffwan commented Sep 26, 2019

/hold

@RedbackThomson
Copy link
Contributor Author

@Jeffwan While we wait for a more permanent container location, I wanted to push this (and another feature through). I've built this container onto my own personal repository.

@Jeffwan
Copy link
Member

Jeffwan commented Sep 30, 2019

/hold cancel

@Jeffwan
Copy link
Member

Jeffwan commented Sep 30, 2019

/ok-to-test

@RedbackThomson
Copy link
Contributor Author

I hope to create a separate PR for JsonObject types so as to test it separately.

@@ -72,6 +75,9 @@ def mnist_classification(region='us-west-2',
"CompressionType": "None", \
"RecordWrapperType": "None", \
"InputMode": "File"}]',
train_spot_instance='False',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I see the changes on the example side.

### Start spot instance support
parser.add_argument('--spot_instance', type=_utils.str_to_bool, required=False, help='Use managed spot training.', default=False)
parser.add_argument('--max_wait_time', type=_utils.str_to_int, required=False, help='The maximum time in seconds you are willing to wait for a managed spot training job to complete.', default=86400)
parser.add_argument('--checkpoint_config', type=_utils.str_to_json_dict, required=False, help='Dictionary of information about the output location for managed spot training checkpoint data.', default='{}')
Copy link
Member

@Jeffwan Jeffwan Oct 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curious checkpoint_config is just for spot training? isn't it a generic config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. The script will only create a checkpoint if it is interrupted by spot instance downtime. Otherwise, it will run from start to finish.

@Jeffwan
Copy link
Member

Jeffwan commented Oct 1, 2019

/lgtm

Wait for one day to see other reviewers have follow up comments. @Ark-kun

@RedbackThomson
Copy link
Contributor Author

Is this ready to merge?

@Ark-kun
Copy link
Contributor

Ark-kun commented Oct 2, 2019

/approve

@Ark-kun
Copy link
Contributor

Ark-kun commented Oct 2, 2019

/approve cancel
I'll let the AWS team approve this.

@Jeffwan
Copy link
Member

Jeffwan commented Oct 3, 2019

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Jeffwan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 12dde37 into kubeflow:master Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants