def create_test_workflow(self, daxfile): # The replica catalog can be empty rcfile = StringIO("") # Just one transformation in the tc tcfile = StringIO(""" tr ls { site local { pfn "/bin/ls" arch "x86_64" os "linux" type "INSTALLED" } } """) # Only the local site in the SC scfile = StringIO("""<?xml version="1.0" encoding="UTF-8"?> <sitecatalog xmlns="http://pegasus.isi.edu/schema/sitecatalog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pegasus.isi.edu/schema/sitecatalog http://pegasus.isi.edu/schema/sc-4.0.xsd" version="4.0"> <site handle="local" arch="x86_64" os="LINUX"> <directory type="shared-scratch" path="%(tmpdir)s/scratch"> <file-server operation="all" url="file://%(tmpdir)s/scratch"/> </directory> <directory type="local-storage" path="%(tmpdir)s/storage"> <file-server operation="all" url="file://%(tmpdir)s/storage"/> </directory> </site> </sitecatalog> """ % {"tmpdir": self.tmpdir}) rc = catalogs.save_catalog("replica", self.username, "replica", "File", rcfile) sc = catalogs.save_catalog("site", self.username, "sites", "XML", scfile) tc = catalogs.save_catalog("transformation", self.username, "transformations", "text", tcfile) conf = StringIO("pegasus.register=false") e = ensembles.create_ensemble(self.username, "process", 1, 1) ew = ensembles.create_ensemble_workflow( e.id, "process", 0, rc, tc, sc, daxfile, conf, sites=["local"], output_site="local", force=True, cleanup=False, ) return e, ew
def test_ensemble_db(self): self.assertEqual(len(ensembles.list_ensembles(self.username)), 0, "Should be no ensembles") e = ensembles.create_ensemble(self.username, "foo", 1, 1) self.assertEqual(len(ensembles.list_ensembles(self.username)), 1, "Should be 1 ensemble") self.assertEqual(len(ensembles.list_actionable_ensembles()), 0, "Should be 0 actionable ensembles") w = ensembles.EnsembleWorkflow(e.id, "bar") db.session.add(w) db.session.flush() self.assertEqual(len(ensembles.list_actionable_ensembles()), 1, "Should be 1 actionable ensembles")
def create_test_workflow(self, daxfile): # The replica catalog can be empty rcfile = StringIO("") # Just one transformation in the tc tcfile = StringIO(""" tr ls { site local { pfn "/bin/ls" arch "x86_64" os "linux" type "INSTALLED" } } """) # Only the local site in the SC scfile = StringIO("""<?xml version="1.0" encoding="UTF-8"?> <sitecatalog xmlns="http://pegasus.isi.edu/schema/sitecatalog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pegasus.isi.edu/schema/sitecatalog http://pegasus.isi.edu/schema/sc-4.0.xsd" version="4.0"> <site handle="local" arch="x86_64" os="LINUX"> <directory type="shared-scratch" path="%(tmpdir)s/scratch"> <file-server operation="all" url="file://%(tmpdir)s/scratch"/> </directory> <directory type="local-storage" path="%(tmpdir)s/storage"> <file-server operation="all" url="file://%(tmpdir)s/storage"/> </directory> </site> </sitecatalog> """ % {"tmpdir": self.tmpdir}) rc = catalogs.save_catalog("replica", self.username, "replica", "File", rcfile) sc = catalogs.save_catalog("site", self.username, "sites", "XML", scfile) tc = catalogs.save_catalog("transformation", self.username, "transformations", "text", tcfile) conf = StringIO("pegasus.register=false") e = ensembles.create_ensemble(self.username, "process", 1, 1) ew = ensembles.create_ensemble_workflow(e.id, "process", 0, rc, tc, sc, daxfile, conf, sites=["local"], output_site="local", force=True, cleanup=False) return e, ew