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 5BA95200C09 for ; Wed, 25 Jan 2017 22:26:44 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 58986160B4E; Wed, 25 Jan 2017 21:26:44 +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 A0AE3160B3D for ; Wed, 25 Jan 2017 22:26:43 +0100 (CET) Received: (qmail 83282 invoked by uid 500); 25 Jan 2017 21:26:42 -0000 Mailing-List: contact dev-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list dev@airflow.incubator.apache.org Received: (qmail 83270 invoked by uid 99); 25 Jan 2017 21:26:42 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jan 2017 21:26:42 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id F3729C0F8E for ; Wed, 25 Jan 2017 21:26:41 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.7 X-Spam-Level: * X-Spam-Status: No, score=1.7 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_SORBS_SPAM=0.5] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=boristyukin.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id kxzfNTC6671A for ; Wed, 25 Jan 2017 21:26:34 +0000 (UTC) Received: from mx36-44.antispamcloud.com (mx36-44.antispamcloud.com [209.126.121.60]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 41D915F472 for ; Wed, 25 Jan 2017 21:26:34 +0000 (UTC) Received: from s2.fcomet.com ([99.198.101.250]) by mx36.antispamcloud.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86) (envelope-from ) id 1cWV5L-0007vw-9d for dev@airflow.incubator.apache.org; Wed, 25 Jan 2017 22:26:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=boristyukin.com; s=default; h=Content-Type:To:Subject:Message-ID:Date:From: References:In-Reply-To:MIME-Version:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=mF+iTmEhOh37E9TcIaU20to0pYQRpMgd2CKfdvOZXKo=; b=dEKt28mkhTO8RhtE4aUgQaB// txVTAK+fwZdo4exq/OKzkTHgMgGwt1KJnX8YkOyYYm4zXAXHkYgRWt1GFYx1k3cVom5CJ46aL3PFg AWXlP3qtQ3PHH/ID95htlNvlk7JbWHc1e0CCHA18CQyNAGVusJlub0UaytME4vLK4uThQ=; Received: from mail-it0-f44.google.com ([209.85.214.44]:37724) by s2.fcomet.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.88) (envelope-from ) id 1cWV5K-002bTc-7F for dev@airflow.incubator.apache.org; Wed, 25 Jan 2017 15:26:30 -0600 Received: by mail-it0-f44.google.com with SMTP id r185so22141983ita.0 for ; Wed, 25 Jan 2017 13:26:30 -0800 (PST) X-Gm-Message-State: AIkVDXJ/KvbKkYmQBvfhZJBZBJ7rI8bMg1ipK1xpGfYl4CGpNrPh6OR6zV5t0OvmNeXt28abhvbsZAvYUqSztA== X-Received: by 10.36.50.206 with SMTP id j197mr12728ita.118.1485379590217; Wed, 25 Jan 2017 13:26:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.19.101 with HTTP; Wed, 25 Jan 2017 13:25:59 -0800 (PST) In-Reply-To: References: From: Boris Tyukin Date: Wed, 25 Jan 2017 16:25:59 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: how to capture sqoop mapreduce counters To: dev@airflow.incubator.apache.org Content-Type: multipart/alternative; boundary=001a114aa33ad4fe420546f1e22c X-AuthUser: boris@boristyukin.com X-Originating-IP: 99.198.101.250 X-SpamExperts-Domain: s2.fcomet.com X-SpamExperts-Username: 99.198.101.250 Authentication-Results: antispamcloud.com; auth=pass smtp.auth=99.198.101.250@s2.fcomet.com X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.07) X-Filter-ID: s0sct1PQhAABKnZB5plbIXcZVAp62mzMrrz7WGWZigeYOauiQumIkkjCCj+KJirn0z6bhalFEM/p jPCQA+BAlgcM/R4oW2re0Q2Lf9CjmsU9RJ7U+VKjDpO54H3J+YdzI/FfcjhbB8Pew7rebGA370tF SuWFVVcrzgujk9s7jldTZ2v6Fjeyca/COTVkNIZwcjwKzVQr86ejTWSFyoOmtRxwEiTVJqDh0qKo KsXx5llZCVUz8Yrj4GPngQNhlfChfqcMMtJ/zwAupRQ6k/uz7Kx7NS+vxl18en0hj4hKZljHJLAo g+xhoE1SNtiS0/scGAMA7pbGOB6N79DhlbzdEeuO5TcDeKjrEmYPn2IVWRv0Km1iMoxCVYEOjxmt mFOFTUuYxI+YVhlKRaDw/2txqRUVprTQC8wJHVozRwqDTkSIDCpR+y9g3J3mIlAP4yaZ/2rAztFe klLxGNN3KHaPkBQvt4BTPsZViF95lKT3rxg/Fjv6XWVOeC6O8uFAhosxBx/LpYht30lTyB4KiPO/ vAuSCKUOScBv/8wPY0bTYi6Z3JKVmi72ocgY5kMQSjs7MHoB+9uVfKPTZrcLDoKtNEpJkzvQFD0n 4ZCeWWj00iQamUdylUIKhf3z2GAHxH7IJ+sFKKOXH8ceQWEmpBxDM3wi21XeXrUcSOZCJxYSDQch WnX2bm28QggWeS3bA41nEguO3VotnkEFj89oT1Ih6FK8TEy4y6D1VUPaqPZqpgLHjlbqHZy1b5XX 4TIwZMvFUi2k2YdREXqNgQEOxqRLD5R5iKHm4elOA75TLaiI4EW/GrqmkFu5xwVS+C4C+YXukRfX mqOW/gKU2hRcc7821jEvuGslKTrRIXcXpFg5ivY= X-Report-Abuse-To: spam@quarantine1.antispamcloud.com X-Recommended-Action: accept archived-at: Wed, 25 Jan 2017 21:26:44 -0000 --001a114aa33ad4fe420546f1e22c Content-Type: text/plain; charset=UTF-8 I figured that luckily for me, the number of rows loaded by sqoop is reported to stdout as the very last line. So I just used BashOperator and set xcom_push=True. Then I did something like that: # Log row_count ingested try: row_count = int(re.search('Retrieved (\d+) records', kwargs['ti'].xcom_pull(task_ ids='t_sqoop_from_cerner')).group(1)) write_job_audit(get_job_audit_id_from_context(kwargs), "rows_ingested_sqoop", row_count) except ValueError: write_job_audit(get_job_audit_id_from_context(kwargs), "rows_ingested_sqoop", -1) The alternative I was considering is to get mapreduce jobid and then use mapred command to get the needed counter - here is an example: mapred job -counter job_1484574566480_0002 org.apache.hadoop.mapreduce.TaskCounter MAP_OUTPUT_RECORDS But I could not figure out an easy way to get job_id from BashOperator / sqoop output. I guess I could create my own operator that would capture all stdout lines not only the last one. On Tue, Jan 24, 2017 at 9:07 AM, Boris Tyukin wrote: > Hello all, > > is there a way to capture sqoop counters either using bash or sqoop > operator? Specifically I need to pull a total number of rows loaded. > > By looking at bash operator, I think there is an option to push the last > line of output to xcom but sqoop and mapreduce output is a bit more > complicated. > > Thanks! > --001a114aa33ad4fe420546f1e22c--