Example #1
0
def run(fileName=None, touch=False):
    # instantiate ADMIT
    a = ad.Admit()

    # Instantiate the class.  This can be done in two ways, both will
    # work, it just depends if you need 'a0' ('i0' you always need)
    if True:
        # the AT, then the ATI
        a0 = File_AT()
        i0 = a.addtask(a0)
    else:
        # get the ATI via ADMIT, but then grab AT reference for convenience 
        i0 = a.addtask(File_AT())
        a0 = a[i0]
    
    # set some keys
    a0.setkey('file', fileName)
    a0.setkey('touch', False)
    a0.setkey('exist', True)


    # run the task(s). This also can be done in two ways.
    if False:
        # run only this one task, but it bypassed some checks in FlowManager
        # so for example, calling it twice, will run it twice
        # after running, explicit BDPs would need to be saved
        a0.run()
        a0[0].write()
    else:
        # run the whole ADMIT flow, although it's just one task (a0)
        # but calling it twice, 2nd run would not run the task since 
        a.run()
        a.write()
Example #2
0
def run(fileName=None, touch=False):
    # instantiate ADMIT
    a = ad.Admit()

    # Instantiate the class.  This can be done in two ways, both will
    # work, it just depends if you need 'a0' ('i0' you always need)
    if True:
        # the AT, then the ATI
        a0 = File_AT()
        i0 = a.addtask(a0)
    else:
        # get the ATI via ADMIT, but then grab AT reference for convenience
        i0 = a.addtask(File_AT())
        a0 = a[i0]

    # set some keys
    a0.setkey('file', fileName)
    a0.setkey('touch', False)
    a0.setkey('exist', True)

    # run the task(s). This also can be done in two ways.
    if False:
        # run only this one task, but it bypassed some checks in FlowManager
        # so for example, calling it twice, will run it twice
        # after running, explicit BDPs would need to be saved
        a0.run()
        a0[0].write()
    else:
        # run the whole ADMIT flow, although it's just one task (a0)
        # but calling it twice, 2nd run would not run the task since
        a.run()
        a.write()
Example #3
0
    n = 3
    touch = True
    subdir = False
    subdir = True

    #  pick where admit will do its work, any cmdline argument will be the dirname
    if len(sys.argv) > 1:
        a = admit.Admit(sys.argv[1])
    else:  # or else the current directory
        a = admit.Admit()

    print 'Flow11:  new admit?', a.new

    a1 = File_AT()
    i1 = a.addtask(a1)
    a1.setkey('file', 'Flow1N.dat')
    a1.setkey('touch', touch)

    a2 = Flow1N_AT()
    i2 = a.addtask(a2, [(i1, 0)])
    a2.setkey('n', n)
    a2.setkey('touch', touch)
    a2.setkey('subdir', subdir)
    #
    if True:
        # continue with a Flow11 for each BDP created by Flow1N
        from admit.at.Flow11_AT import Flow11_AT
        a.run()  # need to run the flow, otherwise #BDP's unknown
        n1 = len(a2)  # of course n1 = n, but we don't know this
        a3 = range(n1)  # a list of AT's
        i3 = range(n1)  # a list of ATID's
Example #4
0
    n = 3
    touch = True
    subdir = False
    subdir = True

    #  pick where admit will do its work, any cmdline argument will be the dirname
    if len(sys.argv) > 1:
        a = admit.Admit(sys.argv[1])
    else:                                 # or else the current directory
        a = admit.Admit()

    print 'Flow11:  new admit?',a.new

    a1 = File_AT()
    i1 = a.addtask(a1)
    a1.setkey('file','Flow1N.dat')
    a1.setkey('touch',touch)

    a2 = Flow1N_AT()
    i2 = a.addtask(a2, [(i1,0)])
    a2.setkey('n',n)
    a2.setkey('touch',touch)
    a2.setkey('subdir',subdir)
    #
    if True:
        # continue with a Flow11 for each BDP created by Flow1N
        from admit.at.Flow11_AT  import Flow11_AT
        a.run()            # need to run the flow, otherwise #BDP's unknown
        n1 = len(a2)       # of course n1 = n, but we don't know this
        a3 = range(n1)     # a list of AT's
        i3 = range(n1)     # a list of ATID's
Example #5
0
    else:
        a = admit.Admit()

    print 'Flow11:  new admit?',a.new
    if not a.new:
        print 'LEN:',len(a)
        print "a[0]._keys:",a[0]._keys
        print "a[1]._keys:",a[1]._keys
        a.run()
        print "run done"
        a.write()
        sys.exit(0)

    a1 = File_AT()
    i1 = a.addtask(a1)
    a1.setkey('file','Flow11-0.dat')
    a1.setkey('touch',True)
    a1.setkey('exist',False)
    print "a1._keys:",a1._keys

    a2 = Flow11_AT()
    i2 = a.addtask(a2, [(i1,0)])
    if subdir:
        # this is to test if subdirectories work  (26-apr, fails to work again on 2nd run)
        a.mkdir('test')
        a2.setkey('file','test/Flow11-1.dat') 
    else:
        a2.setkey('file','Flow11-1.dat') 
    a2.setkey('touch',touch)
    a2.setkey('exist',exist)
Example #6
0
if __name__ == '__main__':

    #  pick where admit will do its work
    if len(sys.argv) > 1:
        # use the argument as a (new or existing) directory
        a = admit.Admit(sys.argv[1])
    else:
        # use the current directory
        a = admit.Admit()

    print 'FlowN1:  new admit?', a.new

    a1 = File_AT()
    i1 = a.addtask(a1)
    a1.setkey('file', 'FlowN1-1.dat')
    a1.setkey('touch', True)

    a2 = File_AT()
    i2 = a.addtask(a2)
    a2.setkey('file', 'FlowN1-2.dat')
    a2.setkey('touch', True)

    a3 = File_AT()
    i3 = a.addtask(a3)
    a3.setkey('file', 'FlowN1-3.dat')
    a3.setkey('touch', True)

    a4 = File_AT()
    i4 = a.addtask(a4)
    a4.setkey('file', 'FlowN1-4.dat')
Example #7
0
if __name__ == '__main__':

    #  pick where admit will do its work
    if len(sys.argv) > 1:
        # use the argument as a (new or existing) directory 
        a = admit.Admit(sys.argv[1])
    else:
        # use the current directory
        a = admit.Admit()

    print 'FlowN1:  new admit?',a.new

    a1 = File_AT()
    i1 = a.addtask(a1)
    a1.setkey('file','FlowN1-1.dat')
    a1.setkey('touch',True)

    a2 = File_AT()
    i2 = a.addtask(a2)
    a2.setkey('file','FlowN1-2.dat')
    a2.setkey('touch',True)

    a3 = File_AT()
    i3 = a.addtask(a3)
    a3.setkey('file','FlowN1-3.dat')
    a3.setkey('touch',True)

    a4 = File_AT()
    i4 = a.addtask(a4)
    a4.setkey('file','FlowN1-4.dat')
Example #8
0
    if len(sys.argv) > 1:
        # use the argument as a (new or existing) directory
        a = admit.Admit(sys.argv[1])
    else:
        # use the current directory
        a = admit.Admit()

    print 'FlowMN:  new admit?', a.new

    if two_step:
        # this will use Flow1N_AT and FlowN1_AT

        # first create a single File_BDP
        a1 = File_AT()
        i1 = a.addtask(a1)
        a1.setkey('file', 'FlowMN-0.dat')
        a1.setkey('touch', touch)

        # turn 1 into M
        a2 = Flow1N_AT()
        i2 = a.addtask(a2, [(i1, 0)])
        a2.setkey('n', m)
        a2.setkey('file', 'FlowMN-1.dat')
        a2.setkey('touch', touch)
        a2.setkey('subdir', subdir)

        # get a list of BDP's for the next step, but we need to run the flow first
        a.run()
        n = len(a2)
        if n != m: print "BAD"
        bdps = []