def run(): # instantiate the class a = ad.Admit() # instantiate a moment AT h = hw.HelloWorld_AT() # add the moment AT to the admit class a.addtask(h) # set some moment parameters h.setkey("yourname","Bill") h.setkey("planet","Mars") # run admit (specifically the tasks that need it) h.execute() # save it out to disk (this will not be needed soon as I a working on # a way to write out the xml inside of the run commmand a.write() a2 = ad.Admit() # read in the admit.xml and bdp.xml files cmd = "rm -f %s/../HelloWorld_AT.p*" % (loc) os.system(cmd) cmd = "rm -f %s/../../bdp/HelloWorld_BDP.p*" % (loc) os.system(cmd) dtd.generate() print "These pairs should match" for at in a.fm: print "FlowManager task ",a.fm[at] print "FlowManager task ",a2.fm[at] print "LEN ",len(a.fm[at]._bdp_out) print "LEN ",len(a2.fm[at]._bdp_out) print "Input ",a.fm[at]._bdp_in[0]._taskid print "Input ",a2.fm[at]._bdp_in[0]._taskid print "\n\n" print "Conn map ",a.fm._connmap print "Conn map ",a2.fm._connmap print "\n\n" print "Conn map ",a.fm._depsmap print "Conn map ",a2.fm._depsmap print "\n\n" for at in a.fm: for i in a.fm[at].bdp_out : if(i.xmlFile == a2.fm[at]._bdp_out[0]._xmlFile): print "File ",i.xmlFile print "File ",a2.fm[at]._bdp_out[0]._xmlFile print "\n\nPASS\n" return print "\n\nFAIL\n"
def run(): # instantiate the class a = ad.Admit() # instantiate a moment AT h = hw.HelloWorld_AT() # add the moment AT to the admit class a.addtask(h) # set some moment parameters h.setkey("yourname", "Bill") h.setkey("planet", "Mars") # run admit (specifically the tasks that need it) h.execute() # save it out to disk (this will not be needed soon as I a working on # a way to write out the xml inside of the run commmand a.write() a2 = ad.Admit() # read in the admit.xml and bdp.xml files cmd = "rm -f %s/../HelloWorld_AT.p*" % (loc) os.system(cmd) cmd = "rm -f %s/../../bdp/HelloWorld_BDP.p*" % (loc) os.system(cmd) dtd.generate() print "These pairs should match" for at in a.fm: print "FlowManager task ", a.fm[at] print "FlowManager task ", a2.fm[at] print "LEN ", len(a.fm[at]._bdp_out) print "LEN ", len(a2.fm[at]._bdp_out) print "Input ", a.fm[at]._bdp_in[0]._taskid print "Input ", a2.fm[at]._bdp_in[0]._taskid print "\n\n" print "Conn map ", a.fm._connmap print "Conn map ", a2.fm._connmap print "\n\n" print "Conn map ", a.fm._depsmap print "Conn map ", a2.fm._depsmap print "\n\n" for at in a.fm: for i in a.fm[at].bdp_out: if (i.xmlFile == a2.fm[at]._bdp_out[0]._xmlFile): print "File ", i.xmlFile print "File ", a2.fm[at]._bdp_out[0]._xmlFile print "\n\nPASS\n" return print "\n\nFAIL\n"
def add_new_at(): """ Method to add a new AT to the ADMIT infrastructure. Alternatively, the command line tool dtdGenerator can be used. Parameters ---------- None Returns ------- None """ # import and run the dtdGenerator, it takes care of everything import admit.xmlio.dtdGenerator as dtd dtd.generate()
writes the results out to disk reads them into a new admit instance prints out one of the BDP xml file names to run this test do the following: import admit.at.test.test_helloworld as th th.run() """ import os loc = os.path.dirname(os.path.realpath(__file__)) cmd = "cp %s/../../../doc/examples/HelloWorld_AT.py %s/../." % (loc,loc) os.system(cmd) cmd = "cp %s/../../../doc/examples/HelloWorld_BDP.py %s/../../bdp/." % (loc,loc) os.system(cmd) import admit.xmlio.dtdGenerator as dtd dtd.generate() import admit.Admit as ad import admit.at.HelloWorld_AT as hw import admit.at.Ingest_AT as ia import admit.util.bdp_types as bt def run(): # instantiate the class a = ad.Admit() # instantiate a moment AT h = hw.HelloWorld_AT() # add the moment AT to the admit class a.addtask(h) # set some moment parameters h.setkey("yourname","Bill")
reads them into a new admit instance prints out one of the BDP xml file names to run this test do the following: import admit.at.test.test_helloworld as th th.run() """ import os loc = os.path.dirname(os.path.realpath(__file__)) cmd = "cp %s/../../../doc/examples/HelloWorld_AT.py %s/../." % (loc, loc) os.system(cmd) cmd = "cp %s/../../../doc/examples/HelloWorld_BDP.py %s/../../bdp/." % (loc, loc) os.system(cmd) import admit.xmlio.dtdGenerator as dtd dtd.generate() import admit.Admit as ad import admit.at.HelloWorld_AT as hw import admit.at.Ingest_AT as ia import admit.util.bdp_types as bt def run(): # instantiate the class a = ad.Admit() # instantiate a moment AT h = hw.HelloWorld_AT() # add the moment AT to the admit class a.addtask(h) # set some moment parameters
#! /usr/bin/env python from admit.bdp import * import admit.xmlio.dtdGenerator as dtdGenerator import admit.xmlio.Parser as Parser import numpy as np if __name__ == "__main__": dtdGenerator.generate() print "Creating initial class" cs = CubeStats.CubeStats() print "Setting initial values" cs.set("project", "cx369") cs.set("mous", "test") cs.set("sous", "test2") cs.set("date", "13-09-10") cs.set("UID", "123456789") cs.set("xmlFile", "cs.225.xml") cs.stats.setData([[1, 2, 3, 4], [5, 6, 7, 8]]) cs.stats.setColumns(["col1", "col2", "col3", "col4"]) print "Writing xml file" cs.write() print "Reading xml file into new class" p = Parser.Parser(None, "cs.225.xml") b = p.parse() print "\n\nComparing classes"