-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Start pushing ml containers #35595
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
Merged
Merged
Start pushing ml containers #35595
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8b804bd
Start pushing ml containers
damccorm cbd1582
Merge branch 'master' of https://github.com/apache/beam into users/da…
damccorm b1151e4
Merge branch 'master' of https://github.com/apache/beam into users/da…
damccorm c00b39d
Consolidate python version values
damccorm 5b7a374
Merge branch 'master' of https://github.com/apache/beam into users/da…
damccorm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you 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. | ||
| */ | ||
|
|
||
| plugins { id 'org.apache.beam.module' } | ||
| applyPythonNature() | ||
|
|
||
| description = "Apache Beam :: SDKs :: Python :: Container :: ML" | ||
| int min_python_version=project.ext.minPythonVersion | ||
| int max_python_version=project.ext.maxPythonVersion | ||
|
|
||
|
|
||
| tasks.register("buildAll") { | ||
| for(int ver=min_python_version; ver<=max_python_version; ++ver) { | ||
| dependsOn ':sdks:python:container:ml:py3' + ver + ':docker' | ||
| } | ||
| } | ||
|
|
||
| for(int i=min_python_version; i<=max_python_version; ++i) { | ||
| String min_version = "3" + min_python_version | ||
| String cur = "3" + i | ||
| String prev = "3" + (i-1) | ||
| tasks.register("push" + cur) { | ||
| if (cur != min_version) { | ||
| // Enforce ordering to allow the prune step to happen between runs. | ||
| // This will ensure we don't use up too much space (especially in CI environments) | ||
| if (!project.hasProperty("skip-python-3" + prev + "-images")) { | ||
| mustRunAfter(":sdks:python:container:ml:push" + prev) | ||
| } | ||
| } | ||
| dependsOn ':sdks:python:container:ml:py' + cur + ':docker' | ||
|
|
||
| doLast { | ||
| if (project.hasProperty("prune-images")) { | ||
| exec { | ||
| executable("docker") | ||
| args("system", "prune", "-a", "--force") | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| tasks.register("pushAll") { | ||
| for(int ver=min_python_version; ver<=max_python_version; ++ver) { | ||
| if (!project.hasProperty("skip-python-3" + ver + "-images")) { | ||
| dependsOn ':sdks:python:container:ml:push3' + ver | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you 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. | ||
| */ | ||
|
|
||
| def pythonVersionSuffix = project.ext.pythonVersion.replace('.', '') | ||
|
|
||
| description = "Apache Beam :: SDKs :: Python :: Container :: ML :: Python ${pythonVersionSuffix} Container" | ||
|
|
||
| configurations { | ||
| sdkSourceTarball | ||
| pythonHarnessLauncher | ||
| } | ||
|
|
||
| dependencies { | ||
| sdkSourceTarball project(path: ":sdks:python", configuration: "distTarBall") | ||
| pythonHarnessLauncher project(path: ":sdks:python:container", configuration: "pythonHarnessLauncher") | ||
| } | ||
|
|
||
| def generatePythonRequirements = tasks.register("generatePythonRequirements") { | ||
| dependsOn ':sdks:python:sdist' | ||
| def pipExtraOptions = project.hasProperty("testRCDependencies") ? "--pre" : "" | ||
| def runScriptsPath = "${rootDir}/sdks/python/container/run_generate_requirements.sh" | ||
| doLast { | ||
| exec { | ||
| executable 'sh' | ||
| args '-c', "cd ${rootDir} && ${runScriptsPath} " + | ||
| "${project.ext.pythonVersion} " + | ||
| "${files(configurations.sdkSourceTarball.files).singleFile} " + | ||
| "base_image_requirements.txt " + | ||
| "[gcp,dataframe,test] " + | ||
| "${pipExtraOptions}" | ||
| } | ||
| // Generate versions for ML dependencies | ||
| exec { | ||
| executable 'sh' | ||
| args '-c', "cd ${rootDir} && ${runScriptsPath} " + | ||
| "${project.ext.pythonVersion} " + | ||
| "${files(configurations.sdkSourceTarball.files).singleFile} " + | ||
| "ml_image_requirements.txt " + | ||
| "[gcp,dataframe,test,tensorflow,torch,transformers] " + | ||
| "${pipExtraOptions}" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| def copyDockerfileDependencies = tasks.register("copyDockerfileDependencies", Copy) { | ||
| from configurations.sdkSourceTarball | ||
| from file("base_image_requirements.txt") | ||
| into "build/target" | ||
| if(configurations.sdkSourceTarball.isEmpty()) { | ||
| throw new StopExecutionException(); | ||
| } | ||
| } | ||
|
|
||
| def copyLicenseScripts = tasks.register("copyLicenseScripts", Copy){ | ||
| from ("../license_scripts") | ||
| into "build/target/license_scripts" | ||
| } | ||
|
|
||
| def copyLauncherDependencies = tasks.register("copyLauncherDependencies", Copy) { | ||
| from configurations.pythonHarnessLauncher | ||
| into "build/target/launcher" | ||
|
|
||
| // Avoid seemingly gradle bug stated in https://github.com/apache/beam/issues/29220 | ||
| mustRunAfter "copyLicenses" | ||
|
|
||
| if(configurations.pythonHarnessLauncher.isEmpty()) { | ||
| throw new StopExecutionException(); | ||
| } | ||
| } | ||
|
|
||
| def pushContainers = project.rootProject.hasProperty(["isRelease"]) || project.rootProject.hasProperty("push-containers") | ||
|
|
||
| docker { | ||
| name containerImageName( | ||
| name: project.docker_image_default_repo_prefix + "python${project.ext.pythonVersion}_sdk_ml", | ||
| root: project.rootProject.hasProperty(["docker-repository-root"]) ? | ||
| project.rootProject["docker-repository-root"] : | ||
| project.docker_image_default_repo_root, | ||
| tag: project.rootProject.hasProperty(["docker-tag"]) ? | ||
| project.rootProject["docker-tag"] : project.sdk_version) | ||
| // tags used by dockerTag task | ||
| tags containerImageTags() | ||
| files "../../Dockerfile", "./build" | ||
| buildArgs(['py_version': "${project.ext.pythonVersion}", | ||
| 'pull_licenses': project.rootProject.hasProperty(["docker-pull-licenses"]) || | ||
| project.rootProject.hasProperty(["isRelease"])]) | ||
| buildx project.useBuildx() | ||
| platform(*project.containerPlatforms()) | ||
| load project.useBuildx() && !pushContainers | ||
| push pushContainers | ||
| } | ||
|
|
||
| dockerPrepare.dependsOn copyLauncherDependencies | ||
| dockerPrepare.dependsOn copyDockerfileDependencies | ||
| dockerPrepare.dependsOn copyLicenseScripts | ||
|
|
||
| if (project.rootProject.hasProperty("docker-pull-licenses")) { | ||
| def copyGolangLicenses = tasks.register("copyGolangLicenses", Copy) { | ||
| from "${project(':release:go-licenses:py').buildDir}/output" | ||
| into "build/target/go-licenses" | ||
| dependsOn ':release:go-licenses:py:createLicenses' | ||
| } | ||
| dockerPrepare.dependsOn copyGolangLicenses | ||
| } else { | ||
| def skipPullLicenses = tasks.register("skipPullLicenses", Exec) { | ||
| executable "sh" | ||
| // Touch a dummy file to ensure the directory exists. | ||
| args "-c", "mkdir -p build/target/go-licenses && touch build/target/go-licenses/skip" | ||
| } | ||
| dockerPrepare.dependsOn skipPullLicenses | ||
| } |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you 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. | ||
| */ | ||
|
|
||
| plugins { | ||
| id 'base' | ||
| id 'org.apache.beam.module' | ||
| } | ||
| applyDockerNature() | ||
| applyPythonNature() | ||
|
|
||
| pythonVersion = '3.10' | ||
|
|
||
| apply from: "../common.gradle" |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you 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. | ||
| */ | ||
|
|
||
| plugins { | ||
| id 'base' | ||
| id 'org.apache.beam.module' | ||
| } | ||
| applyDockerNature() | ||
| applyPythonNature() | ||
|
|
||
| pythonVersion = '3.11' | ||
|
|
||
| apply from: "../common.gradle" |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you 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. | ||
| */ | ||
|
|
||
| plugins { | ||
| id 'base' | ||
| id 'org.apache.beam.module' | ||
| } | ||
| applyDockerNature() | ||
| applyPythonNature() | ||
|
|
||
| pythonVersion = '3.12' | ||
|
|
||
| apply from: "../common.gradle" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you 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. | ||
| */ | ||
|
|
||
| plugins { | ||
| id 'base' | ||
| id 'org.apache.beam.module' | ||
| } | ||
| applyDockerNature() | ||
| applyPythonNature() | ||
|
|
||
| pythonVersion = '3.13' | ||
|
|
||
| apply from: "../common.gradle" | ||
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I was running into env issues which kept me from generating 3.13 requirements, but this should get generated before we start publishing 3.13 containers anyways.