示例#1
0
class CreateFile2Short(batch.BatchQ):
    _ = batch.WildCard()
    directory = batch.Property()
    command = batch.Property()

    terminal = batch.Pipeline(BashTerminal)

    create_dir = home_create_dir(directory,_)
    create_file = send_command(command)
示例#2
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)
示例#3
0
class CreateFile3(CreateFile2):
    server = batch.Property()
    username = batch.Property()
    password = batch.Property()

    # This overwrites our previous terminal and SSH is now used
    # instead. One of neat things about this method is that no instance
    # of Bash will be opened as the terminal is just overridden. 
    # Still a new terminal is created for every instance of the object.
    terminal = batch.Pipeline(SSHTerminal, server,username,password)
示例#4
0
class CreateFile1(batch.BatchQ):
    _ = batch.WildCard()

    directory = batch.Property()
    command = batch.Property()

    terminal = batch.Pipeline(BashTerminal)
    
    create_file = batch.Function() \
        .home().chdir(_) \
        .chdir(directory).send_command(command)
示例#5
0
class CreateFile2(batch.BatchQ):
    _ = batch.WildCard()
    directory = batch.Property()
    command = batch.Property()

    terminal = batch.Pipeline(BashTerminal)

    create_dir = batch.Function(verbose=True) \
        .home().chdir(_) \
        .exists(directory).don(1).mkdir(directory, True) \
        .chdir(directory)
    
    create_file = batch.Function(create_dir) \
        .send_command(command)
示例#6
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)
示例#7
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)
示例#8
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.")
示例#9
0
class HelloParam(batch.BatchQ):
    message = batch.Property("Parameter")
    ctrl = batch.Controller(Pipeline)
    fnc = batch.Function().hello(message)
示例#10
0
class CreateFileSSH(CreateFileShort):
    server = batch.Property()
    username = batch.Property()
    password = batch.Property()
    terminal = batch.Controller(SSHTerminal, server, username, password)
示例#11
0
class Q3(batch.BatchQ):
    message = batch.Property("Hello property")
    pipe = batch.Controller(TestPipe2)
    fnc = batch.Function().hello_world(message)