Skip to content

Commit

Permalink
major reworking of moa simple, map & reduce - now uses history
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fiers committed Dec 2, 2012
1 parent f68950e commit 26396a2
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions moa/plugin/system/adhoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def simple(job, args):
Create a 'simple' adhoc job.
Simple meaning that no in or output files are tracked. Moa will
query you for a command to execute (the `process` parameter).
query you for a command to execute (the `process` parameter). Note
that Moa tracks a history for all 'process' parameters used.
"""
_createAdhocJob(job, args, 'simple',
[ ('process', None)
Expand All @@ -104,48 +105,57 @@ def simple(job, args):
@moa.args.commandName('simple!')
def simpleX(job, args):
"""
Create a 'simple' adhoc job.
Create a 'simple' adhoc job.
Simple meaning that no in or output files are tracked. Moa will
query you for a command to execute (the `process` parameter).
This command is exactly the same as `moa simple` except for the
fact that Moa uses the bash history specific for the moa job or,
if absent, the user bash history. This is convenient if you would
like to register or reuse a command that you have alreayd
executed.
"""

_createAdhocJob(job, args, 'simple',
[ ('process', _get_bash_history_file())])


@moa.args.argument('-t', '--title', help='A title for this job')
@moa.args.forceable
@moa.args.commandName('map!')
def createMapX(job, args):
@moa.args.commandName('map')
def createMap(job, args):
"""
create an adhoc moa 'map' job
Moa will query the user for process, input & output files. An
example session
Moa will query the user for process, input & output files. A `map`
job maps a set of input files on a set of output files, executing
the `process` command for each combination. The `process`
parameter is interpreted as a Jinja2 template with the input file
available as `{{ input }}` and the output as `{{ output }}`.
"""
_createAdhocJob(job, args, 'map', [
( 'process', _get_bash_history_file() ),
('process', None ),
('input', None),
('output', None),
])


@moa.args.argument('-t', '--title', help='A title for this job')
@moa.args.forceable
@moa.args.commandName('map')
def createMap(job, args):
@moa.args.commandName('map!')
def createMapX(job, args):
"""
create an adhoc moa 'map' job
Moa will query the user for process, input & output files. An
example session
This command is exactly the same as `moa map` but uses the Moa
local (or user) bash history instead.
"""
_createAdhocJob(job, args, 'map', [
('process', None ),
( 'process', _get_bash_history_file() ),
('input', None),
('output', None),
])


@moa.args.argument('-t', '--title', help='A title for this job')
@moa.args.forceable
@moa.args.commandName('reduce')
Expand Down

0 comments on commit 26396a2

Please sign in to comment.