Skip to content

Commit

Permalink
a few minor stylistic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
klbostee committed Dec 10, 2010
1 parent 71c05ba commit cb38482
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions dumbo/core.py
Expand Up @@ -36,8 +36,8 @@ class Job(object):


def __init__(self): def __init__(self):
self.iters = [] self.iters = []
self.deps = {} self.deps = {} # will contain last dependency for each node
self.start = -1 self.root = -1 # id for the job's root input


def additer(self, *args, **kwargs): def additer(self, *args, **kwargs):
kwargs.setdefault('input', len(self.iters)-1) kwargs.setdefault('input', len(self.iters)-1)
Expand Down Expand Up @@ -68,9 +68,9 @@ def run(self):
addpathopt = getopt(opts, 'addpath', delete=False) addpathopt = getopt(opts, 'addpath', delete=False)
getpathopt = getopt(opts, 'getpath', delete=False) getpathopt = getopt(opts, 'getpath', delete=False)


job_input = getopt(opts, 'input', delete=False) job_inputs = getopt(opts, 'input', delete=False)
if not job_input: if not job_inputs:
print >> sys.stderr, 'ERROR: No output path specified' print >> sys.stderr, 'ERROR: No input path specified'
sys.exit(1) sys.exit(1)


outputopt = getopt(opts, 'output', delete=False) outputopt = getopt(opts, 'output', delete=False)
Expand All @@ -87,7 +87,7 @@ def run(self):
if type(input) == int: if type(input) == int:
input = [input] input = [input]
if input == [-1]: if input == [-1]:
kwargs['input'] = job_input kwargs['input'] = job_inputs
if delinputsopt and delinputsopt[0] == 'yes' and iter == self.deps[-1]: if delinputsopt and delinputsopt[0] == 'yes' and iter == self.deps[-1]:
newopts['delinputs'] = 'yes' newopts['delinputs'] = 'yes'
else: else:
Expand Down Expand Up @@ -128,6 +128,7 @@ def run(self):
if iter == self.deps[initer]: if iter == self.deps[initer]:
fs.rm(job_output + "_pre" + str(initer + 1), opts) fs.rm(job_output + "_pre" + str(initer + 1), opts)



class Program(object): class Program(object):


def __init__(self, prog, opts=[]): def __init__(self, prog, opts=[]):
Expand Down Expand Up @@ -379,7 +380,7 @@ def run(mapper,
opts += parseargs(sys.argv[1:]) opts += parseargs(sys.argv[1:])


if input is not None: if input is not None:
inputopt = getopt(opts, 'input', delete=True) getopt(opts, 'input', delete=True) # delete -input opts
for infile in input: for infile in input:
opts.append(('input', infile)) opts.append(('input', infile))


Expand Down

0 comments on commit cb38482

Please sign in to comment.