[ 
https://issues.apache.org/jira/browse/BEAM-5613?focusedWorklogId=152479&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-152479
 ]

ASF GitHub Bot logged work on BEAM-5613:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Oct/18 00:20
            Start Date: 09/Oct/18 00:20
    Worklog Time Spent: 10m 
      Work Description: chamikaramj closed pull request #6551: [BEAM-5613] 
Snapshot of Python depedency and add it to nightly snapshot job
URL: https://github.com/apache/beam/pull/6551
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.test-infra/jenkins/job_Release_Python_NightlySnapshot.groovy 
b/.test-infra/jenkins/job_Release_Python_NightlySnapshot.groovy
index 969313364e1..b4653a13484 100644
--- a/.test-infra/jenkins/job_Release_Python_NightlySnapshot.groovy
+++ b/.test-infra/jenkins/job_Release_Python_NightlySnapshot.groovy
@@ -41,11 +41,19 @@ job('beam_Release_Python_NightlySnapshot') {
             'Run Python Publish')
 
     steps {
+      // Cleanup Python directory.
       gradle {
         rootBuildScriptDir(commonJobProperties.checkoutDir)
-        tasks(':beam-sdks-python:sdist')
+        tasks(':beam-sdks-python:clean')
         commonJobProperties.setGradleSwitches(delegate)
       }
+      // Build snapshot.
+      gradle {
+        rootBuildScriptDir(commonJobProperties.checkoutDir)
+        tasks(':beam-sdks-python:buildSnapshot')
+        commonJobProperties.setGradleSwitches(delegate)
+      }
+      // Publish snapshot to a public accessible GCS directory.
       shell('cd ' + commonJobProperties.checkoutDir +
         ' && bash sdks/python/scripts/run_snapshot_publish.sh')
     }
diff --git a/sdks/python/build.gradle b/sdks/python/build.gradle
index b99f153697f..a4ca68219da 100644
--- a/sdks/python/build.gradle
+++ b/sdks/python/build.gradle
@@ -84,6 +84,19 @@ task buildPython(dependsOn: 'setupVirtualenv') {
 }
 build.dependsOn buildPython
 
+// Snapshot of dependency requirements defined in setup.py.
+// Results will be stored in files under Gradle build directory.
+task depSnapshot(dependsOn: 'installGcpTest') {
+  doLast {
+    println 'Snapshoting full dependencies requirements with versions info to 
requirements.txt.'
+    exec {
+      // Remove useless item "pkg-resources" from file which is introduced by 
a bug in Ubuntu.
+      executable 'sh'
+      args '-c', ". ${envdir}/bin/activate && pip freeze --local --all | grep 
-v \"pkg-resources\" > ${project.buildDir}/requirements.txt"
+    }
+  }
+}
+
 task lint {}
 check.dependsOn lint
 
@@ -361,3 +374,8 @@ task dependencyUpdates(dependsOn: ':dependencyUpdates') {
     }
   }
 }
+
+task buildSnapshot() {
+  dependsOn 'sdist'
+  dependsOn 'depSnapshot'
+}
diff --git a/sdks/python/scripts/run_snapshot_publish.sh 
b/sdks/python/scripts/run_snapshot_publish.sh
index 88231493f2b..302dcbf0d26 100755
--- a/sdks/python/scripts/run_snapshot_publish.sh
+++ b/sdks/python/scripts/run_snapshot_publish.sh
@@ -16,19 +16,27 @@
 #    limitations under the License.
 #
 
+BUCKET=gs://beam-python-nightly-snapshots
 
 VERSION=$(awk '/__version__/{print $3}' 
$WORKSPACE/src/sdks/python/apache_beam/version.py)
 VERSION=$(echo $VERSION | cut -c 2- | rev | cut -c 2- | rev)
 time=$(date +"%Y-%m-%dT%H:%M:%S")
 SNAPSHOT="apache-beam-$VERSION-$time.zip"
-BUCKET=gs://beam-python-nightly-snapshots
 
+DEP_SNAPSHOT_ROOT="$BUCKET/dependency_requirements_snapshot"
+DEP_SNAPSHOT_FILE_NAME="beam-py-requirements-$time.txt"
+
+# Snapshots are built by Gradle task :beam-sdks-python:depSnapshot
+# and located under Gradle build directory.
 cd $WORKSPACE/src/sdks/python/build
 
-# rename the file to be apache-beam-{VERSION}-{datetime}.zip
+# Rename the file to be apache-beam-{VERSION}-{datetime}.zip
 for file in "apache-beam-$VERSION*.zip"; do
   mv $file $SNAPSHOT
 done
 
-# upload to gcs bucket
+# Upload to gcs bucket
 gsutil cp $SNAPSHOT $BUCKET/$VERSION/
+
+# Upload requirements.txt to gcs.
+gsutil cp requirements.txt $DEP_SNAPSHOT_ROOT/$DEP_SNAPSHOT_FILE_NAME


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 152479)
    Time Spent: 2h 50m  (was: 2h 40m)

> Snapshot Python dependencies and add to Python_NightlySnapshot
> --------------------------------------------------------------
>
>                 Key: BEAM-5613
>                 URL: https://issues.apache.org/jira/browse/BEAM-5613
>             Project: Beam
>          Issue Type: Improvement
>          Components: dependencies
>            Reporter: Mark Liu
>            Assignee: Mark Liu
>            Priority: Major
>          Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> Python SDK depends on a list of libraries without specific versions. 
> Unexpected or unaware version change could happen if there is a new release 
> or range change in setup.py. This can be detected by dependency checking 
> tools which require to track dependency list and their versions periodically. 
> We could snapshot dependencies periodically using pip freeze and python 
> setup.py egg_info and upload them to a public accessible location to benefit 
> people who want to check dependency info or building related tools.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to