You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "VVildVVolf (via GitHub)" <gi...@apache.org> on 2023/05/07 05:41:06 UTC

[GitHub] [airflow] VVildVVolf opened a new pull request, #31118: Add batch_size param for BatchPredictionJob objects

VVildVVolf opened a new pull request, #31118:
URL: https://github.com/apache/airflow/pull/31118

   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #31118: `CreateBatchPredictionJobOperator` Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #31118:
URL: https://github.com/apache/airflow/pull/31118#discussion_r1188142923


##########
airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py:
##########
@@ -207,6 +209,14 @@ def create_batch_prediction_job(
         :param sync: Whether to execute this method synchronously. If False, this method will be executed in
             concurrent Future and any downstream object will be immediately returned and synced when the
             Future has completed.
+        :param create_request_timeout: Optional. The timeout for the create request in seconds.
+        :param batch_size: Optional. The number of the records (e.g. instances)
+            of the operation given in each batch
+            to a machine replica. Machine type, and size of a single record should be considered
+            when setting this parameter, higher value speeds up the batch operation's execution,
+            but too high value will result in a whole batch not fitting in a machine's memory,
+            and the whole operation will fail.
+            The default value is 64.

Review Comment:
   ```suggestion
               The default value is same as in the aiplatform's BatchPredictionJob.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] VVildVVolf commented on a diff in pull request #31118: Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "VVildVVolf (via GitHub)" <gi...@apache.org>.
VVildVVolf commented on code in PR #31118:
URL: https://github.com/apache/airflow/pull/31118#discussion_r1187895107


##########
airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py:
##########
@@ -114,6 +114,8 @@ def create_batch_prediction_job(
         labels: dict[str, str] | None = None,
         encryption_spec_key_name: str | None = None,
         sync: bool = True,
+        create_request_timeout: float | None = None,
+        batch_size: int | None = None,

Review Comment:
   BTW, [Google's implementation](https://github.com/googleapis/python-aiplatform/blob/main/google/cloud/aiplatform/jobs.py#L402) has `None` as default value (possibly due to not sending default one over network).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] hussein-awala commented on a diff in pull request #31118: Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "hussein-awala (via GitHub)" <gi...@apache.org>.
hussein-awala commented on code in PR #31118:
URL: https://github.com/apache/airflow/pull/31118#discussion_r1186860967


##########
airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py:
##########
@@ -181,6 +189,8 @@ def __init__(
         labels: dict[str, str] | None = None,
         encryption_spec_key_name: str | None = None,
         sync: bool = True,
+        create_request_timeout: float | None = None,
+        batch_size: int | None = None,

Review Comment:
   same here



##########
airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py:
##########
@@ -114,6 +114,8 @@ def create_batch_prediction_job(
         labels: dict[str, str] | None = None,
         encryption_spec_key_name: str | None = None,
         sync: bool = True,
+        create_request_timeout: float | None = None,
+        batch_size: int | None = None,

Review Comment:
   Since the google API client replace the None value by 64, why we don't provide a 64 as default value to make it clearer (and maybe avoid auto-updating the default value if the client updates it in the next versions)
   ```suggestion
           batch_size: int = 64,
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] VVildVVolf commented on a diff in pull request #31118: Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "VVildVVolf (via GitHub)" <gi...@apache.org>.
VVildVVolf commented on code in PR #31118:
URL: https://github.com/apache/airflow/pull/31118#discussion_r1186862722


##########
airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py:
##########
@@ -114,6 +114,8 @@ def create_batch_prediction_job(
         labels: dict[str, str] | None = None,
         encryption_spec_key_name: str | None = None,
         sync: bool = True,
+        create_request_timeout: float | None = None,
+        batch_size: int | None = None,

Review Comment:
   Looks like it is their responsibility, do you think would be better duplicate it, or we can trust in Google's implementation? There were a bug once, related to extra copying default value of param



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] VVildVVolf commented on pull request #31118: `CreateBatchPredictionJobOperator` Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "VVildVVolf (via GitHub)" <gi...@apache.org>.
VVildVVolf commented on PR #31118:
URL: https://github.com/apache/airflow/pull/31118#issuecomment-1546717279

   @potiuk, @hussein-awala, Is there anything else can be improved before merging? :) 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] VVildVVolf commented on a diff in pull request #31118: Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "VVildVVolf (via GitHub)" <gi...@apache.org>.
VVildVVolf commented on code in PR #31118:
URL: https://github.com/apache/airflow/pull/31118#discussion_r1186877921


##########
airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py:
##########
@@ -114,6 +114,8 @@ def create_batch_prediction_job(
         labels: dict[str, str] | None = None,
         encryption_spec_key_name: str | None = None,
         sync: bool = True,
+        create_request_timeout: float | None = None,
+        batch_size: int | None = None,

Review Comment:
   To be honest I don't think it is a good idea to duplicate existing external code. The description says actual defaults on the final end and we can rely on Google's implementation.
   
   If google would ever change it - we would not need update every wrap of their SDK. But if we will keep default value on our side - we will need to check these points every time when we update of sdk.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #31118: `CreateBatchPredictionJobOperator` Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #31118:
URL: https://github.com/apache/airflow/pull/31118#discussion_r1188142545


##########
airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py:
##########
@@ -114,6 +114,8 @@ def create_batch_prediction_job(
         labels: dict[str, str] | None = None,
         encryption_spec_key_name: str | None = None,
         sync: bool = True,
+        create_request_timeout: float | None = None,
+        batch_size: int | None = None,

Review Comment:
   Yeah. Having None there is good, and I would say we should simply refer to the default value from the original API - we don't have to specify it here, we can get description "Default is the same as in the BatchPredictionJob from aiplaatform API and we are good.
   
   Honestly - do we care what is the default in this operator in this case?  Not relly, should we describe what it is - yes. Does it have to be a constant? not really - we can defer to the original API. This way it will be both - correct and future-prof.



##########
airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py:
##########
@@ -114,6 +114,8 @@ def create_batch_prediction_job(
         labels: dict[str, str] | None = None,
         encryption_spec_key_name: str | None = None,
         sync: bool = True,
+        create_request_timeout: float | None = None,
+        batch_size: int | None = None,

Review Comment:
   Yeah. Having None there is good, and I would say we should simply refer to the default value from the original API - we don't have to specify it here, we can get description "Default is the same as in the BatchPredictionJob from aiplaatform API and we are good.
   
   Honestly - do we care what is the default in this operator in this case?  Not relly, should we describe what it is - yes. Does it have to be a constant? not really - we can defer to the original API. This way it will be both - correct and future-proof.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on pull request #31118: `CreateBatchPredictionJobOperator` Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #31118:
URL: https://github.com/apache/airflow/pull/31118#issuecomment-1546718467

   Nope. Merged :).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk merged pull request #31118: `CreateBatchPredictionJobOperator` Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #31118:
URL: https://github.com/apache/airflow/pull/31118


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] pankajkoti commented on a diff in pull request #31118: Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "pankajkoti (via GitHub)" <gi...@apache.org>.
pankajkoti commented on code in PR #31118:
URL: https://github.com/apache/airflow/pull/31118#discussion_r1186870267


##########
airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py:
##########
@@ -114,6 +114,8 @@ def create_batch_prediction_job(
         labels: dict[str, str] | None = None,
         encryption_spec_key_name: str | None = None,
         sync: bool = True,
+        create_request_timeout: float | None = None,
+        batch_size: int | None = None,

Review Comment:
   I had the same question initially, that the docstring says the default is 64, but we set it to None. Later realised that the Google library will set the default to 64 even though we send as None. If we do not want to set the default to 64, IMO, we could still provide more details in the docstring param that the library sets it to 64 even though we set it None. 
   
   If I was developing this, I would set the default to 64 here itself, but that's just my opinion and I maybe wrong :) 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] hussein-awala commented on a diff in pull request #31118: Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "hussein-awala (via GitHub)" <gi...@apache.org>.
hussein-awala commented on code in PR #31118:
URL: https://github.com/apache/airflow/pull/31118#discussion_r1186864055


##########
airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py:
##########
@@ -114,6 +114,8 @@ def create_batch_prediction_job(
         labels: dict[str, str] | None = None,
         encryption_spec_key_name: str | None = None,
         sync: bool = True,
+        create_request_timeout: float | None = None,
+        batch_size: int | None = None,

Review Comment:
   IMHO, changing the default value is a breaking change, they will list it in their release notes when they change it, but when we upgrade the client version (like you do in this PR), we don't check all these changes and duplicate them.
   I have no objection. @potiuk @pankajkoti WDYT?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] VVildVVolf commented on a diff in pull request #31118: Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "VVildVVolf (via GitHub)" <gi...@apache.org>.
VVildVVolf commented on code in PR #31118:
URL: https://github.com/apache/airflow/pull/31118#discussion_r1186878622


##########
airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py:
##########
@@ -114,6 +114,8 @@ def create_batch_prediction_job(
         labels: dict[str, str] | None = None,
         encryption_spec_key_name: str | None = None,
         sync: bool = True,
+        create_request_timeout: float | None = None,
+        batch_size: int | None = None,

Review Comment:
   @potiuk what is your opinion?
   
   P.S. there is another PR (https://github.com/apache/airflow/pull/31082) exact about cutting off default values, what worked fine in the past, but faced with a bug.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] VVildVVolf commented on a diff in pull request #31118: Add batch_size param for Vertex AI BatchPredictionJob objects

Posted by "VVildVVolf (via GitHub)" <gi...@apache.org>.
VVildVVolf commented on code in PR #31118:
URL: https://github.com/apache/airflow/pull/31118#discussion_r1187895107


##########
airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py:
##########
@@ -114,6 +114,8 @@ def create_batch_prediction_job(
         labels: dict[str, str] | None = None,
         encryption_spec_key_name: str | None = None,
         sync: bool = True,
+        create_request_timeout: float | None = None,
+        batch_size: int | None = None,

Review Comment:
   BTW, [Google's implementation](https://github.com/googleapis/python-aiplatform/blob/main/google/cloud/aiplatform/jobs.py#L402) has `None` as default value (possibly due to not sending default one over network).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org