Esempio n. 1
0
 def testAlternates(self):
     "Should find executables on specific paths"
     self.assertTrue(
         utils.find_exec(
             program="simple.sh", otherdirs=["/doesntexist", self.test_dir]
         )
         is not None
     )
Esempio n. 2
0
def generate_dax_graph(wf_info, output_dir, create_dax_files=False):
	"""
	Generates the DAX graph
	@wf_info WorkflowInfo object reference
	@output_dir the output directory path
	@create_dax_files  whether to include files when visualizing dax 
	"""
	dax_file_path = wf_info.dax_file_path
	title =  str(wf_info.wf_uuid) + " (" + str(wf_info.dax_label) +")"
	if dax_file_path is not None:
		dax2dot_file_path = os.path.join(bin_dir, "pegasus-graphviz")
		dot_file_path = os.path.join(output_dir, wf_info.wf_uuid + ".dot")
		dax_cmd = dax2dot_file_path 
		dax_cmd +=" --output "+ dot_file_path
		if create_dax_files:
			dax_cmd += " --files "
		dax_cmd += " "+ dax_file_path
		logger.debug("Executing command :\n"  + dax_cmd)
		status, output = commands.getstatusoutput(dax_cmd)
		if status == 0:
			logger.debug("Finished executing command." )
		else:
			logger.warn("Failed to generate dax graph for workflow " + title)
			logger.debug("%s: %d:%s" % (dax_cmd, status, output))
			return None
		# Find dot command
		dot_png_cmd = utils.find_exec("dot")
		if dot_png_cmd is None:
			logger.warn("dot is not present . Unable to create chart in png format. ")
			return None
		png_file_path = os.path.join(output_dir, wf_info.wf_uuid + ".png")
		dot_png_cmd +=" -Tpng -o" + png_file_path
		dot_png_cmd += " "+ dot_file_path
		logger.debug("Executing command :\n"  + dot_png_cmd)
		status, output = commands.getstatusoutput(dot_png_cmd)
		if status == 0:
			logger.debug("Finished executing command." )
			return status
		else:
			logger.warn("Failed to generate dax graph in png format for workflow " + wf_info.wf_uuid)
			logger.debug("%s: %d:%s" % (dot_png_cmd, status, output))
	else:
		logger.warn("Unable to find the dax file for workflow " + title)
	return None
Esempio n. 3
0
 def testWorkingDir(self):
     "Should find executables in the current directory"
     self.assertTrue(utils.find_exec("simple.sh", True) is not None)
Esempio n. 4
0
 def testNotFound(self):
     "Should not find non-existent executables"
     self.assertTrue(utils.find_exec("doesntexistorshouldnt") is None)
Esempio n. 5
0
 def testSimple(self):
     "Should always be able to find ls given default path"
     self.assertTrue(utils.find_exec("ls") is not None)
Esempio n. 6
0
 def testAlternates(self):
     "Should find executables on specific paths"
     self.assertTrue(utils.find_exec(program="simple.sh", otherdirs=["/doesntexist", self.test_dir]) is not None)
Esempio n. 7
0
 def testNotFound(self):
     "Should not find non-existent executables"
     self.assertTrue(utils.find_exec("doesntexistorshouldnt") is None)
Esempio n. 8
0
 def testWorkingDir(self):
     "Should find executables in the current directory"
     self.assertTrue(utils.find_exec('simple.sh', True) is not None)
Esempio n. 9
0
 def testSimple(self):
     "Should always be able to find ls given default path"
     self.assertTrue(utils.find_exec('ls') is not None)