File: my_tasks.py

package info (click to toggle)
doit 0.25.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,404 kB
  • ctags: 1,504
  • sloc: python: 11,084; makefile: 111; ansic: 14
file content (31 lines) | stat: -rw-r--r-- 642 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

def task(*fn, **kwargs):
    # decorator without parameters
    if fn:
        function = fn[0]
        function.task_metadata = {}
        return function

    # decorator with parameters
    def wrap(function):
        function.task_metadata = kwargs
        return function
    return wrap



@task
def simple():
    print "thats all folks"

@task(output=['out1.txt', 'out2.txt'])
def create(to_be_created):
    print "I should create these files: %s" % " ".join(to_be_created)

@task(input=['my_input.txt'], output=['my_output_result.txt'])
def process(in_, out_):
    print "processing %s" % in_[0]
    print "creating %s" % out_[0]