[
https://issues.apache.org/jira/browse/BEAM-4302?focusedWorklogId=114049&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-114049
]
ASF GitHub Bot logged work on BEAM-4302:
----------------------------------------
Author: ASF GitHub Bot
Created on: 21/Jun/18 04:09
Start Date: 21/Jun/18 04:09
Worklog Time Spent: 10m
Work Description: yifanzou commented on a change in pull request #5406:
[BEAM-4302] add beam dependency checks
URL: https://github.com/apache/beam/pull/5406#discussion_r197003586
##########
File path: .test-infra/jenkins/dependency_check/bigquery_client_utils.py
##########
@@ -0,0 +1,68 @@
+#
+# 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.
+#
+
+from google.cloud import bigquery
+
+class BigQueryClientUtils:
+
+ def __init__(self, project_id, dataset_id, table_id):
+ self.project_id = project_id
+ self.dataset_id = dataset_id
+ self.table_id = table_id
+ self.bigquery_client = bigquery.Client(project_id)
+ self.table_ref = self.bigquery_client.dataset(dataset_id).table(table_id)
+ self.table = self.bigquery_client.get_table(self.table_ref)
+
+
+ def query_dep_release_date(self, dep, version):
+ """
+ Query for release date of a specific version
+ Args:
+ dep, version
+ Return:
+ release_date
+ """
+ query = """SELECT release_date
+ FROM `{0}.{1}.{2}`
+ WHERE package_name=\'{3}\' and version=\'{4}\'""".format(self.project_id,
+ self.dataset_id,
+ self.table_id,
+ dep.strip(),
+ version.strip())
+
+ query_job = self.bigquery_client.query(query)
+ rows = list(query_job)
+ if len(rows) == 0:
+ return None
+ assert len(rows) == 1
+ return rows[0]['release_date']
+
+
+ def add_dep_to_table(self, dep, version, release_date,
is_current_using=False):
Review comment:
Um... This is a value I prepare for BigQuery table cleanup. At the end of
Jenkins job, it suppose to clean stale records (for example: the release date
is over 3 years from today and is not currently used in Beam) from BQ tables.
However, I found that the bigquery client library doesn't support deleting a
(group of) specific tuples, correct me if I am wrong. I might have to do that
by DML statements.
----------------------------------------------------------------
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: 114049)
> Fix to dependency hell
> ----------------------
>
> Key: BEAM-4302
> URL: https://issues.apache.org/jira/browse/BEAM-4302
> Project: Beam
> Issue Type: New Feature
> Components: testing
> Reporter: yifan zou
> Assignee: yifan zou
> Priority: Major
> Time Spent: 62h
> Remaining Estimate: 0h
>
> # For Java, a daily Jenkins test to compare version of all Beam dependencies
> to the latest version available in Maven Central.
> # For Python, a daily Jenkins test to compare versions of all Beam
> dependencies to the latest version available in PyPI.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)