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.user_id, "replica", "File", rcfile) sc = catalogs.save_catalog("site", self.user_id, "sites", "XML", scfile) tc = catalogs.save_catalog("transformation", self.user_id, "transformations", "text", tcfile) conf = StringIO("pegasus.register=false") e = ensembles.create_ensemble(self.user_id, "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_relationship(self): u = users.create(username="******", password="******", email="*****@*****.**") c = catalogs.save_catalog("replica", u.id, "rc.txt", "regex", StringIO("replica")) self.assertEquals(c.user.username, "scott")