Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1554E200B61 for ; Mon, 25 Jul 2016 21:04:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 13FE6160A67; Mon, 25 Jul 2016 19:04:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 593E2160A7D for ; Mon, 25 Jul 2016 21:04:12 +0200 (CEST) Received: (qmail 49129 invoked by uid 500); 25 Jul 2016 19:04:11 -0000 Mailing-List: contact commits-help@beam.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@beam.incubator.apache.org Delivered-To: mailing list commits@beam.incubator.apache.org Received: (qmail 49117 invoked by uid 99); 25 Jul 2016 19:04:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jul 2016 19:04:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 06ED3187924 for ; Mon, 25 Jul 2016 19:04:11 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id qwrvUroYieVK for ; Mon, 25 Jul 2016 19:04:09 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 55C9B5F396 for ; Mon, 25 Jul 2016 19:04:08 +0000 (UTC) Received: (qmail 48974 invoked by uid 99); 25 Jul 2016 19:04:07 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jul 2016 19:04:07 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 58946E02E4; Mon, 25 Jul 2016 19:04:07 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: robertwb@apache.org To: commits@beam.incubator.apache.org Date: Mon, 25 Jul 2016 19:04:09 -0000 Message-Id: In-Reply-To: <51080a94d83d46f0bcaa923ec5d96944@git.apache.org> References: <51080a94d83d46f0bcaa923ec5d96944@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/4] incubator-beam git commit: Allow passing logging context directly. archived-at: Mon, 25 Jul 2016 19:04:13 -0000 Allow passing logging context directly. This is better than passing a logger module with a specific class. Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/de35f282 Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/de35f282 Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/de35f282 Branch: refs/heads/python-sdk Commit: de35f28294dfb4f47b429635eff843b38279e240 Parents: d20cf64 Author: Robert Bradshaw Authored: Sat Jul 23 00:54:11 2016 -0700 Committer: Robert Bradshaw Committed: Mon Jul 25 11:57:42 2016 -0700 ---------------------------------------------------------------------- sdks/python/apache_beam/runners/common.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/de35f282/sdks/python/apache_beam/runners/common.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/runners/common.py b/sdks/python/apache_beam/runners/common.py index 9c9ab22..c017704 100644 --- a/sdks/python/apache_beam/runners/common.py +++ b/sdks/python/apache_beam/runners/common.py @@ -62,7 +62,9 @@ class DoFnRunner(Receiver): context, tagged_receivers, logger=None, - step_name=None): + step_name=None, + # Preferred alternative to logger + logging_context=None): if not args and not kwargs: self.dofn = fn self.dofn_process = fn.process @@ -85,9 +87,13 @@ class DoFnRunner(Receiver): self.window_fn = windowing.windowfn self.context = context self.tagged_receivers = tagged_receivers - self.logging_context = get_logging_context(logger, step_name=step_name) self.step_name = step_name + if logging_context: + self.logging_context = logging_context + else: + self.logging_context = get_logging_context(logger, step_name=step_name) + # Optimize for the common case. self.main_receivers = as_receiver(tagged_receivers[None])