-
Notifications
You must be signed in to change notification settings - Fork 1.2k
change: Add warning for ignored job args in pipeline steps #3814
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| from __future__ import absolute_import | ||
|
|
||
| import abc | ||
| import logging | ||
| import warnings | ||
|
|
||
| from enum import Enum | ||
|
|
@@ -54,6 +55,14 @@ | |
| if TYPE_CHECKING: | ||
| from sagemaker.workflow.step_collections import StepCollection | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| JOB_ARG_IGNORE_WARN_MSG_TEMPLATE = ( | ||
| "The job specific arguments (%s) supplied to the step will be ignored, " | ||
| "because `step_args` is presented. These job specific arguments should be supplied " | ||
| "in %s to generate the `step_args`." | ||
| ) | ||
|
|
||
|
|
||
| class StepTypeEnum(Enum, metaclass=DefaultEnumMeta): | ||
| """Enum of `Step` types.""" | ||
|
|
@@ -424,6 +433,9 @@ def __init__( | |
| error_message="The step_args of TrainingStep must be obtained from estimator.fit().", | ||
| ) | ||
|
|
||
| if inputs: | ||
| logger.warning(JOB_ARG_IGNORE_WARN_MSG_TEMPLATE, "`inputs`", "estimator.fit()") | ||
|
|
||
| self.step_args = step_args | ||
| self.estimator = estimator | ||
| self.inputs = inputs | ||
|
|
@@ -680,6 +692,11 @@ def __init__( | |
| "from transformer.transform().", | ||
| ) | ||
|
|
||
| if inputs: | ||
| logger.warning( | ||
| JOB_ARG_IGNORE_WARN_MSG_TEMPLATE, "`inputs`", "transformer.transform()" | ||
| ) | ||
|
|
||
| self.step_args = step_args | ||
| self.transformer = transformer | ||
| self.inputs = inputs | ||
|
|
@@ -817,6 +834,13 @@ def __init__( | |
| error_message="The step_args of ProcessingStep must be obtained from processor.run().", | ||
| ) | ||
|
|
||
| if job_arguments or inputs or outputs or code or kms_key: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we check for each individually? Otherwise the error message might get confusing |
||
| logger.warning( | ||
| JOB_ARG_IGNORE_WARN_MSG_TEMPLATE, | ||
| "`job_arguments`, `inputs`, `outputs`, `code` and `kms_key`", | ||
| "processor.run()", | ||
| ) | ||
|
|
||
| self.step_args = step_args | ||
| self.processor = processor | ||
| self.inputs = inputs | ||
|
|
@@ -997,6 +1021,9 @@ def __init__( | |
| error_message="The step_args of TuningStep must be obtained from tuner.fit().", | ||
| ) | ||
|
|
||
| if inputs: | ||
| logger.warning(JOB_ARG_IGNORE_WARN_MSG_TEMPLATE, "`inputs`", "tuner.fit()") | ||
|
|
||
| self.step_args = step_args | ||
| self.tuner = tuner | ||
| self.inputs = inputs | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -363,8 +363,8 @@ def override_pipeline_parameter_var(func): | |
| We should remove this decorator after the grace period. | ||
| """ | ||
| warning_msg_template = ( | ||
| "The input argument %s of function (%s) is a pipeline variable (%s), which is not allowed. " | ||
| "The default_value of this Parameter object will be used to override it. " | ||
| "The input argument %s of function (%s) is a pipeline variable (%s), which will not work. " | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The obvious question here for any user will be: "why will it not work?" We should get this reviewed by a doc writer to get the least confusing wording |
||
| "Thus the default_value of this Parameter object will be used to override it. " | ||
| "Please make sure the default_value is valid." | ||
| ) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo in presented. Should be replaced with present