Permalink
Browse files

adapt Job's run method to fix error reporting (fixes #56)

  • Loading branch information...
Klaas Bosteels
Klaas Bosteels committed Jun 28, 2012
1 parent e439f10 commit c57cad01fa68f894963064a5850c7b7fbae40874
Showing with 10 additions and 5 deletions.
  1. +10 −5 dumbo/core.py
View
@@ -53,12 +53,17 @@ def additer(self, *args, **kwargs):
return iter
def run(self):
- for _iter, (args, kwargs) in enumerate(self.iters):
- kwargs['iter'] = _iter
-
- if len(sys.argv) > 1 and not sys.argv[1][0] == '-':
+ if len(sys.argv) > 1 and not sys.argv[1][0] == '-':
+ iterarg = 0 # default value
+ if len(sys.argv) > 2:
+ iterarg = int(sys.argv[2])
+ # for loop isn't necessary but helps for error reporting apparently
+ for args, kwargs in self.iters[iterarg:iterarg+1]:
+ kwargs['iter'] = iterarg
run(*args, **kwargs)
- else:
+ else:
+ for _iter, (args, kwargs) in enumerate(self.iters):
+ kwargs['iter'] = _iter
opts = Options(kwargs.get('opts', []))
opts += parseargs(sys.argv[1:])

0 comments on commit c57cad0

Please sign in to comment.