Skip to content

Commit

Permalink
Implemented the reviewer request: Removed the Optional[str] annotatio…
Browse files Browse the repository at this point in the history
…ns where default value cannot be specified
  • Loading branch information
Ark-kun committed Apr 1, 2022
1 parent 57b1241 commit fee7b89
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
3 changes: 2 additions & 1 deletion google/cloud/aiplatform/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ def _validate_metadata_schema_uri(self) -> None:
@classmethod
def create(
cls,
display_name: Optional[str],
# TODO(b/223262536): Make the display_name parameter optional in the next major release
display_name: str,
metadata_schema_uri: str,
gcs_source: Optional[Union[str, Sequence[str]]] = None,
bq_source: Optional[str] = None,
Expand Down
17 changes: 9 additions & 8 deletions google/cloud/aiplatform/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ def completion_stats(self) -> Optional[gca_completion_stats.CompletionStats]:
@classmethod
def create(
cls,
job_display_name: Optional[str],
# TODO(b/223262536): Make the job_display_name parameter optional in the next major release
job_display_name: str,
model_name: Union[str, "aiplatform.Model"],
instances_format: str = "jsonl",
predictions_format: str = "jsonl",
Expand Down Expand Up @@ -374,7 +375,7 @@ def create(
Args:
job_display_name (str):
Optional. The user-defined name of the BatchPredictionJob.
Required. The user-defined name of the BatchPredictionJob.
The name can be up to 128 characters long and can be consist
of any UTF-8 characters.
model_name (Union[str, aiplatform.Model]):
Expand Down Expand Up @@ -1013,7 +1014,7 @@ class CustomJob(_RunnableJob):
def __init__(
self,
# TODO(b/223262536): Make display_name parameter fully optional in next major release
display_name: Optional[str],
display_name: str,
worker_pool_specs: Union[List[Dict], List[aiplatform.gapic.WorkerPoolSpec]],
base_output_dir: Optional[str] = None,
project: Optional[str] = None,
Expand Down Expand Up @@ -1059,7 +1060,7 @@ def __init__(
Args:
display_name (str):
Optional. The user-defined name of the HyperparameterTuningJob.
Required. The user-defined name of the HyperparameterTuningJob.
The name can be up to 128 characters long and can be consist
of any UTF-8 characters.
worker_pool_specs (Union[List[Dict], List[aiplatform.gapic.WorkerPoolSpec]]):
Expand Down Expand Up @@ -1173,7 +1174,7 @@ def _log_web_access_uris(self):
def from_local_script(
cls,
# TODO(b/223262536): Make display_name parameter fully optional in next major release
display_name: Optional[str],
display_name: str,
script_path: str,
container_uri: str,
args: Optional[Sequence[str]] = None,
Expand Down Expand Up @@ -1216,7 +1217,7 @@ def from_local_script(
Args:
display_name (str):
Optional. The user-defined name of this CustomJob.
Required. The user-defined name of this CustomJob.
script_path (str):
Required. Local path to training script.
container_uri (str):
Expand Down Expand Up @@ -1493,7 +1494,7 @@ class HyperparameterTuningJob(_RunnableJob):
def __init__(
self,
# TODO(b/223262536): Make display_name parameter fully optional in next major release
display_name: Optional[str],
display_name: str,
custom_job: CustomJob,
metric_spec: Dict[str, str],
parameter_spec: Dict[str, hyperparameter_tuning._ParameterSpec],
Expand Down Expand Up @@ -1567,7 +1568,7 @@ def __init__(
Args:
display_name (str):
Optional. The user-defined name of the HyperparameterTuningJob.
Required. The user-defined name of the HyperparameterTuningJob.
The name can be up to 128 characters long and can be consist
of any UTF-8 characters.
custom_job (aiplatform.CustomJob):
Expand Down
5 changes: 3 additions & 2 deletions google/cloud/aiplatform/pipeline_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ class PipelineJob(base.VertexAiResourceNounWithFutureManager):

def __init__(
self,
# TODO(b/223262536): Make the display_name parameter optional in the next major release
display_name: str,
template_path: str,
display_name: Optional[str],
job_id: Optional[str] = None,
pipeline_root: Optional[str] = None,
parameter_values: Optional[Dict[str, Any]] = None,
Expand All @@ -106,7 +107,7 @@ def __init__(
Args:
display_name (str):
Optional. The user-defined name of this Pipeline.
Required. The user-defined name of this Pipeline.
template_path (str):
Required. The path of PipelineJob or PipelineSpec JSON file. It
can be a local path or a Google Cloud Storage URI.
Expand Down
20 changes: 10 additions & 10 deletions google/cloud/aiplatform/training_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ class _CustomTrainingJob(_TrainingJob):
def __init__(
self,
# TODO(b/223262536): Make display_name parameter fully optional in next major release
display_name: Optional[str],
display_name: str,
container_uri: str,
model_serving_container_image_uri: Optional[str] = None,
model_serving_container_predict_route: Optional[str] = None,
Expand All @@ -1040,7 +1040,7 @@ def __init__(
"""
Args:
display_name (str):
Optional. The user-defined name of this TrainingPipeline.
Required. The user-defined name of this TrainingPipeline.
container_uri (str):
Required: Uri of the training container image in the GCR.
model_serving_container_image_uri (str):
Expand Down Expand Up @@ -1556,7 +1556,7 @@ class CustomTrainingJob(_CustomTrainingJob):
def __init__(
self,
# TODO(b/223262536): Make display_name parameter fully optional in next major release
display_name: Optional[str],
display_name: str,
script_path: str,
container_uri: str,
requirements: Optional[Sequence[str]] = None,
Expand Down Expand Up @@ -1616,7 +1616,7 @@ def __init__(
Args:
display_name (str):
Optional. The user-defined name of this TrainingPipeline.
Required. The user-defined name of this TrainingPipeline.
script_path (str): Required. Local path to training script.
container_uri (str):
Required: Uri of the training container image in the GCR.
Expand Down Expand Up @@ -2388,7 +2388,7 @@ class CustomContainerTrainingJob(_CustomTrainingJob):
def __init__(
self,
# TODO(b/223262536): Make display_name parameter fully optional in next major release
display_name: Optional[str],
display_name: str,
container_uri: str,
command: Sequence[str] = None,
model_serving_container_image_uri: Optional[str] = None,
Expand Down Expand Up @@ -2446,7 +2446,7 @@ def __init__(
Args:
display_name (str):
Optional. The user-defined name of this TrainingPipeline.
Required. The user-defined name of this TrainingPipeline.
container_uri (str):
Required: Uri of the training container image in the GCR.
command (Sequence[str]):
Expand Down Expand Up @@ -3197,7 +3197,7 @@ class AutoMLTabularTrainingJob(_TrainingJob):
def __init__(
self,
# TODO(b/223262536): Make display_name parameter fully optional in next major release
display_name: Optional[str],
display_name: str,
optimization_prediction_type: str,
optimization_objective: Optional[str] = None,
column_specs: Optional[Dict[str, str]] = None,
Expand Down Expand Up @@ -3225,7 +3225,7 @@ def __init__(
Args:
display_name (str):
Optional. The user-defined name of this TrainingPipeline.
Required. The user-defined name of this TrainingPipeline.
optimization_prediction_type (str):
The type of prediction the Model is to produce.
"classification" - Predict one out of multiple target values is
Expand Down Expand Up @@ -5005,7 +5005,7 @@ class CustomPythonPackageTrainingJob(_CustomTrainingJob):
def __init__(
self,
# TODO(b/223262536): Make display_name parameter fully optional in next major release
display_name: Optional[str],
display_name: str,
python_package_gcs_uri: str,
python_module_name: str,
container_uri: str,
Expand Down Expand Up @@ -6177,7 +6177,7 @@ class AutoMLTextTrainingJob(_TrainingJob):
def __init__(
self,
# TODO(b/223262536): Make display_name parameter fully optional in next major release
display_name: Optional[str],
display_name: str,
prediction_type: str,
multi_label: bool = False,
sentiment_max: int = 10,
Expand Down

0 comments on commit fee7b89

Please sign in to comment.