-
Notifications
You must be signed in to change notification settings - Fork 596
Kubernetes Job service #5113
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
base: master
Are you sure you want to change the base?
Kubernetes Job service #5113
Changes from all commits
f02d4a0
697cdd7
3310027
7f12a07
b986275
5b7b4d5
ca629cd
234f0ac
6838442
eec7e6b
110440b
ef6e272
636a3bf
7cd5067
f76c56f
e9c7f7d
b837c06
a498af0
2d723a8
d531174
172ee90
bd08a69
3075c41
81d8407
e196477
3692699
ae2e936
c108e35
092e27f
9b3a503
941c7d1
2114adf
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 |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Copyright 2025 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| name: Run Kubernetes e2e tests | ||
| on: [pull_request] | ||
|
|
||
| permissions: read-all | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-24.04 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - run: | # Needed for git diff to work. | ||
| git fetch origin master --depth 1 | ||
| git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master | ||
|
|
||
| - name: Setup python environment | ||
| uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 | ||
| with: | ||
| python-version: 3.11 | ||
|
|
||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '21' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Run Kubernetes e2e tests | ||
| run: ./local/tests/kubernetes_e2e_test.bash |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,6 +64,12 @@ | |
| 'regression': 24 * 60 * 60, | ||
| } | ||
|
|
||
|
|
||
| def get_task_duration(command): | ||
| """Gets the duration of a task.""" | ||
| return TASK_LEASE_SECONDS_BY_COMMAND.get(command, TASK_LEASE_SECONDS) | ||
|
|
||
|
|
||
| TASK_QUEUE_DISPLAY_NAMES = { | ||
| 'LINUX': 'Linux', | ||
| 'LINUX_WITH_GPU': 'Linux (with GPU)', | ||
|
|
@@ -503,6 +509,7 @@ def __init__(self, pubsub_message): | |
| } | ||
|
|
||
| self.eta = datetime.datetime.utcfromtimestamp(float(self.attribute('eta'))) | ||
| self.do_not_ack = False | ||
|
|
||
| def attribute(self, key): | ||
| """Return attribute value.""" | ||
|
|
@@ -550,7 +557,8 @@ def lease(self, _event=None): # pylint: disable=arguments-differ | |
| leaser_thread.join() | ||
|
|
||
| # If we get here the task succeeded in running. Acknowledge the message. | ||
| self._pubsub_message.ack() | ||
| if not self.do_not_ack: | ||
|
Collaborator
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. What is this change?
Contributor
Author
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. Its part of the job limiter for the Kubernetes service, we can probably use this for implement the job limiter for Batch as well, using the new feature they implemented for us. The rationale behind is if the task cannot be scheduled for Kubernetes because it already reached the limit of jobs, the message should not be acked, allowing the other adapter, such as Batch, to process the message.
Contributor
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. IMO readability would be improved by using |
||
| self._pubsub_message.ack() | ||
| track_task_end() | ||
|
|
||
| def dont_retry(self): | ||
|
|
@@ -587,7 +595,8 @@ def lease(self, _event=None): # pylint: disable=arguments-differ | |
| leaser_thread.join() | ||
|
|
||
| # If we get here the task succeeded in running. Acknowledge the message. | ||
| self._pubsub_message.ack() | ||
| if not self.do_not_ack: | ||
| self._pubsub_message.ack() | ||
| track_task_end() | ||
|
|
||
|
|
||
|
|
@@ -730,6 +739,7 @@ def __init__(self, | |
| grandparent_class.__init__(command, output_url_argument, job_type, eta, | ||
| is_command_override, high_end) | ||
| self._pubsub_message = pubsub_message | ||
| self.do_not_ack = False | ||
|
|
||
| def ack(self): | ||
| self._pubsub_message.ack() | ||
|
|
||
This file was deleted.
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.
This is only intended to be used in CI?
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.
Yes!