Skip to content
This repository has been archived by the owner on Mar 22, 2020. It is now read-only.

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
johncosta committed Sep 29, 2013
1 parent 7151d36 commit 2f5a9c9
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions worker/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

root_path = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join(root_path, 'lib'))
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s',
level=logging.INFO)
logging.basicConfig(
format='%(asctime)s %(levelname)s: %(message)s', level=logging.INFO)
logger = logging.getLogger('calculator')


Expand All @@ -24,8 +24,8 @@ def load_modules(path, prefix):
continue
name = fname[:-3]
try:
mod = __import__('{0}.{1}'.format(path, name), globals(),
locals(), [name], -1)
mod = __import__(
'{0}.{1}'.format(path, name), globals(), locals(), [name], -1)
yield mod
except Exception as e:
logger.warning('Ignoring "{0}": {1}'.format(name, e))
Expand All @@ -44,8 +44,9 @@ def run_module(mod, *args):
result = mod.score(*args)
break
except Exception:
logger.exception('{0}: returned an error.'
' Retrying in 1 second...'.format(mod.__name__))
logger.exception(
'{0}: returned an error.'
' Retrying in 1 second...'.format(mod.__name__))
retry -= 1
time.sleep(1)
continue
Expand Down Expand Up @@ -90,6 +91,7 @@ def post_job(project, post_results):
data=payload, auth=AUTH)
print(r.text)


def handle_job(project):
logger.info('Starting... {0}'.format(project))
project = json.loads(project)
Expand All @@ -109,4 +111,4 @@ def run():

if __name__ == '__main__':
logger.info('Starting calculator')
run()
run()

0 comments on commit 2f5a9c9

Please sign in to comment.