Ejemplo n.º 1
0
class Q6(batch.BatchQ):
    _ = batch.WildCard()
    _r = batch.WildCard(reverse=True)
    _l = batch.WildCard(lifo=False)
    _lr = batch.WildCard(lifo=False, reverse=True)
    _3 = batch.WildCard(select=3)

    pipe = batch.Controller(TestPipe4)

    call_fnc = batch.Function() \
        .fnc1() \
        .fnc2() \
        .fnc3() \
        .fnc4() \
        .fnc5()

    test1 = batch.Function(call_fnc) \
        .display(_)

    test2 = batch.Function(call_fnc) \
        .display2(_,_)

    test3 = batch.Function(call_fnc) \
        .display2(_r,_r)

    test4 = batch.Function(call_fnc) \
        .display2(_l,_l)

    test5 = batch.Function(call_fnc) \
        .display2(_lr,_lr)

    test6 = batch.Function(call_fnc) \
        .display(_3)

    display1 = batch.Function().fnc1()
Ejemplo n.º 2
0
class Q2a(batch.BatchQ):
    pipe = batch.Controller(TestPipe1)

    # Here we indicate that errors should be printed
    fnc1 = batch.Function(verbose=True).hello_world("Hello error")

    # Default is not to print errors
    fnc2 = batch.Function(verbose=False).hello_world("Hello error")
Ejemplo n.º 3
0
class CreateFileShort(batch.BatchQ):
    _ = batch.WildCard()
    directory = batch.Property()
    command = batch.Property()

    terminal = batch.Controller(BashTerminal)

    create_dir = home_create_dir(directory, _)
    create_file = send_command(command, inherits=create_dir)
Ejemplo n.º 4
0
class CreateFileAndDirectory(batch.BatchQ):
    _ = batch.WildCard()
    directory = batch.Property()
    command = batch.Property()

    terminal = batch.Controller(BashTerminal)

    create_dir = batch.Function() \
        .home().chdir(_) \
        .exists(directory).Qdon(1).mkdir(directory, True) \
        .chdir(directory)

    create_file = batch.Function(create_dir) \
        .send_command(command)
Ejemplo n.º 5
0
class NoHUP(batch.BatchQ):
    _r = batch.WildCard(reverse = True)
    _ = batch.WildCard()

    input_directory = batch.Property()
    working_directory = batch.Property()
    command = batch.Property()

    terminal = batch.Controller(BashTerminal)

    workdir = batch.Function() \
        .home().chdir(_).exists(working_directory) \
        .don(1).mkdir(working_directory).chdir(working_directory)

    _set_copy_dirs = batch.Function(workdir, verbose=False) \
        .pjoin(input_directory, "/*").pjoin(working_directory, "/").cp(_r, _r) \

    transfer_infiles = batch.Function(_set_copy_dirs , verbose=False) \
        .cp(_r, _r).don(1).throw("Failed to transfer files.")

    transfer_outfiles = batch.Function(_set_copy_dirs, verbose=False) \
        .cp(_, _).don(1).throw("Failed to transfer files.")

    startjob = batch.Function(workdir) \
        .join("(", command, " > .bacthq.output & echo $! > .batchq.pid )").send_command(_) 

    transfer_startjob = batch.Function(transfer_infiles) \
        .call(startjob)


    getpid = batch.Function(workdir) \
        .cat(".batchq.pid")

    isrunning = batch.Function(getpid) \
        .isrunning(_)

    wasstarted = batch.Function(workdir) \
        .exists(".batchq.output")

    log = batch.Function(wasstarted) \
        .do(1).cat(".batchq.output")

    clean = batch.Function(wasstarted) \
        .do(1).rm(".batchq.*", force = True)
Ejemplo n.º 6
0
class NoHUPStart(batch.BatchQ):
    _r = batch.WildCard(reverse = True)
    _ = batch.WildCard()

    input_directory = batch.Property()
    working_directory = batch.Property()
    command = batch.Property()

    terminal = batch.Controller(BashTerminal)

    workdir = batch.Function() \
        .home().chdir(_).exists(working_directory) \
        .don(1).mkdir(working_directory).chdir(working_directory)

    _set_copy_dirs = batch.Function(workdir, verbose=False) \
        .pjoin(input_directory, "/*").pjoin(working_directory, "/").cp(_r, _r) \

    transfer_infiles = batch.Function(_set_copy_dirs , verbose=False)
        .cp(_r, _r).don(1).throw("Failed to transfer files.")
Ejemplo n.º 7
0
class CallIt2(batch.BatchQ):
    _ = batch.WildCard()
    ctrl = batch.Controller(Pipe)
    fnc1 = batch.Function().display("Hello world")
    fnc2 = batch.Function().Qjoin(fnc1, " II").display(_)
Ejemplo n.º 8
0
class Model(batch.BatchQ):
    ctrl = batch.Controller(object)
    fnc1 = batch.Function().Qthrow(
        exception=StandardError("Custom error class"))
    fnc2 = batch.Function().Qthrow("Standard error")
Ejemplo n.º 9
0
class HelloParam(batch.BatchQ):
    message = batch.Property("Parameter")
    ctrl = batch.Controller(Pipeline)
    fnc = batch.Function().hello(message)
Ejemplo n.º 10
0
class CreateFileSSH(CreateFileShort):
    server = batch.Property()
    username = batch.Property()
    password = batch.Property()
    terminal = batch.Controller(SSHTerminal, server, username, password)
Ejemplo n.º 11
0
class Q5(Q4):
    pipe = batch.Controller(TestPipe3)
Ejemplo n.º 12
0
class Q4(batch.BatchQ):

    pipe = batch.Controller(TestPipe2)
    fnc1 = batch.Function(verbose=True).hello_world("Hello from FNC1")
    fnc2 = batch.Function(fnc1, verbose=True).hello_world("Hello from FNC2")
Ejemplo n.º 13
0
class Q3(batch.BatchQ):
    message = batch.Property("Hello property")
    pipe = batch.Controller(TestPipe2)
    fnc = batch.Function().hello_world(message)
Ejemplo n.º 14
0
class Q1(batch.BatchQ):
    pipe = batch.Controller(TestPipe1)
    fnc = batch.Function().hello_world()
Ejemplo n.º 15
0
class CallIt1(batch.BatchQ):
    ctrl = batch.Controller(Pipe)
    fnc1 = batch.Function().display("Hello world")
    fnc2 = batch.Function().display("Before call").Qcall(fnc1).display("After call") \
        .Qprint_stack()
Ejemplo n.º 16
0
class HelloWorld(batch.BatchQ):
    ctrl = batch.Controller(Pipeline)
    fnc = batch.Function().hello_world().hello_batchq()
Ejemplo n.º 17
0
class Inherits(batch.BatchQ):
    ctrl = batch.Controller(Pipe)
    fnc1 = batch.Function().display("Hello world")
    fnc2 = batch.Function(fnc1).display("Hello world II")