Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62728

Re: Getting updates and restarting a long running url request.

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jsf80238@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.030
X-Spam-Evidence '*H*': 0.95; '*S*': 0.01; 'subject:Getting': 0.07; 'except:': 0.09; 'try:': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; "'''": 0.16; 'input': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'could': 0.34; 'received:google.com': 0.35; 'false': 0.36; 'track': 0.38; 'blast': 0.84; 'dict()': 0.84; 'subject:long': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SREBtE0zlhKzZjFfaXwsixoGol23385qyBes+uTLhRY=; b=IkFmaMFf2L5izTsjmt21gs530i8tbj6Y7ZMirVxVPno8cFZO6ItOMNk+pUfSY4NCbN rwc9NzLQY7L+VotHIToP4RhYOE/g/8UBF6r5pg3PoYI7m8u7ruQE9jLndL6l29rssE6H rWBUadKaEC6nU38G4Y5qRCPn72GGWwP0CnSyzV9/1Obgbtm8YHhbgkdlVWg4wycccYcy +VeVlf3EYCNHjBdqLOpdtZAXyubdHQ5kLhKqrkeAgo1ktdgZ5aumpiT3AiIkgVyeevYW bl9onRfrQW+WDY7cPxNTm4AeFADNmwFu/txKBiuKveAGXVbI2QpwS+uwinCu3uVFHuqd yAJw==
MIME-Version 1.0
X-Received by 10.50.78.229 with SMTP id e5mr32145853igx.49.1388039080466; Wed, 25 Dec 2013 22:24:40 -0800 (PST)
In-Reply-To <CALyJZZXX4cBtx_VVFpEWB8WEkVPNbgj0r-T1XX5nttmZWkNHDw@mail.gmail.com>
References <CALyJZZXX4cBtx_VVFpEWB8WEkVPNbgj0r-T1XX5nttmZWkNHDw@mail.gmail.com>
Date Wed, 25 Dec 2013 23:24:40 -0700
Subject Re: Getting updates and restarting a long running url request.
From Jason Friedman <jsf80238@gmail.com>
To Vincent Davis <vincent@vincentdavis.net>
Content-Type text/plain; charset=UTF-8
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4624.1388039088.18130.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1388039088 news.xs4all.nl 2932 [2001:888:2000:d::a6]:35412
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62728

Show key headers only | View raw


> I am using the following code to submit the query/
> def get_BLAST(taxid, queryseq, args=None):
>     '''
>     Input taxid to BLAST queryseq against
>     '''
>     e_query = "txid" + taxid + " [ORGN]"
>     #, other_advanced='-G 4 -E 1'
>     blast_result = NCBIWWW.qblast("blastn", "nt", queryseq, megablast=True,
> entrez_query=e_query, word_size='11', other_advanced='-G 5 -E 2')
>     return NCBIXML.read(blast_result)

Could you keep track of success?

result_dict = dict()
for id in taxid_list:
    result_dict[id] = False
while not all(result_dict.values()): # continue if not every ID was successful
    for id in taxid_list:
        if result_dict[id]:
            continue # We were already successful with this ID
        try:
            this_result = get_BLAST(id)
            result_dict[id] = True
        except:
            print("A warning.")

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Getting updates and restarting a long running url request. Jason Friedman <jsf80238@gmail.com> - 2013-12-25 23:24 -0700

csiph-web