Skip to content

Instantly share code, notes, and snippets.

View dlemphers's full-sized avatar
⚒️
Hacking and hustling

David Lemphers dlemphers

⚒️
Hacking and hustling
  • Melbourne, Australia
View GitHub Profile
@dlemphers
dlemphers / python_config_read_try_except
Created December 7, 2011 23:21
Simple Python Config Read try/except block for IOError
try:
self.config.readfp(open(config_file_path))
except IOError as (errno, strerror):
logging.warning('I/O error({0}): {1}'.format(errno, strerror))
logging.warning('Please check that {0} exists'.format(config_file_path))
@lrvick
lrvick / results.py
Created June 22, 2011 18:03 — forked from ask/get_results.py
Get async celery results from nested subtasks as they complete
from tasks import task1
def get_results(queries):
query_procs = task1.delay(queries).get().join()
results = []
for query_proc in query_procs:
# while the following iterate() is happening, the other query_procs are ignored.
# ideas on iterating over all of them at once?
for result in query_proc.iterate():
yield result