Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ankur Agrawal Newsgroups: comp.lang.python Subject: Error handling with @parallel decorator Date: Mon, 18 Jan 2016 06:15:24 +0000 Lines: 38 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 1FQ4zzBOcQLVNiuK2ZJd/QLA7ZxXmJdAADInEpOzfDfg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'tries': 0.05; 'exception.': 0.07; 'method,': 0.07; 'subject:Error': 0.07; 'abort': 0.09; 'block.': 0.09; 'exception': 0.13; 'output': 0.13; 'exception")': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:handling': 0.16; 'threw': 0.16; 'timed': 0.16; 'try:': 0.18; 'to:name:python-list@python.org': 0.20; 'pass': 0.22; 'trying': 0.22; 'thanks,': 0.24; 'header:In-Reply-To:1': 0.24; 'command': 0.26; 'message-id:@mail.gmail.com': 0.27; 'host': 0.28; 'print': 0.30; 'code': 0.30; 'somebody': 0.30; 'class': 0.33; 'except': 0.34; 'received:google.com': 0.35; 'instead': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'two': 0.37; 'missing': 0.37; 'received:209': 0.38; 'anything': 0.38; 'skip:p 20': 0.38; "didn't": 0.39; 'skip:e 20': 0.39; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'still': 0.40; 'skip:n 10': 0.62; 'different': 0.63; 'time)': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-type; bh=XzR2UY4MQnGF06sCmfoQ67yluqoJCcZ5iTOnAoGWHio=; b=YdiepvU0O30tupkTDFZBK+m+oMZSYic21Z6ohDt/F6b8UDshTgYAHCAzg3aKCHhcLA 5zIzbZU/jqegZ35P1aULcTn8MjbGwdunajRcm1OlBiGFagM76GmZOCfmCk5s+wB5Lwn6 NlKDDOyAW9z+LAvh6Kspzdz73M/inXHZieiY+r9hV/mo6slkYUmJLv76ulSQKJUh1pSr DjFQlH564CEIWggQwJrF1DCGL9m39VH5tpwIblUbLBTu4sbgP6oXo9wQJO8zJv6y3ayU QCCbLqprbXrrD7cPeZqvrSieWBTu5RbMoWptsD7P+T+S5jIVH8FRHoMDgsYsVNT5VpQj ZjFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; bh=XzR2UY4MQnGF06sCmfoQ67yluqoJCcZ5iTOnAoGWHio=; b=IDG6gPmrhOtwfIAlyYxdfnjaVygyPCSG5P+wTlzWhc8mFWpHA7unhgyJgQbcBi+UVL +dq5LlGFbATfGUoBfjMAYhZmSH84luCq52+W0QAw/KkwswmR4EvTyri1Wotv14XrN7aU r5TlwwP+ALagotsvLv/98AY6KTPwP3KJIQ3Gf8/IJC9zan6HFVK7pYJEYIUdIySKLKq/ cxbv+9WeY2qhRO8C/yFidyZ2zbqJd6rCIAruva0MKKWicqmb8TiDOjxFK/RFldOe7CXL hP7WdZTAlk0XVh317B9F32gm8f76y9BWtg0fgSVMJa1Vr4/BdRgfcKB7g5BlymXIiRAx vYwA== X-Gm-Message-State: ALoCoQmcEtKwKTP0suJ9eegruztCXexnMLarEDzL44nKBDRWUgfkdnDytUqHvDG27EkLu0C1HatgAR+8PUONV7SY3P6REFAdhw== X-Received: by 10.37.45.6 with SMTP id t6mr4509684ybt.112.1453097734481; Sun, 17 Jan 2016 22:15:34 -0800 (PST) In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.20+ X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:101870 I am trying to catch Abort exception. When I use fabric's run(...) method, the host it tries to connect is not available and so it aborts with connect time out exception. I am not able to catch it. Following is a two different ways of code snippet- First I try following - class FabricException(Exception): pass with settings(abort_exception = FabricException): try: output = run(command) except FabricException: print 'inside exception' LOG.debug("inside exception") It didn't go in exception block. Instead it threw - NetworkError: Timed out trying to connect to pqaltsnas300.corp.intuit.net (tried 1 time) Aborting. SystemExit: 1 Then I try to continue even if exception - command = 'ls -l' with settings(warn_only = True): output = run(command) Still it threw the same exception NetworkError: Timed out trying to connect to pqaltsnas300.corp.intuit.net (tried 1 time) Aborting. SystemExit: 1 Appreciate if somebody tell if I am missing anything ? Thanks, Ankur