def clean_up(self): logging.info("Cleaning up Google Cloud Platform.") # Remove dummy files from output directory try: logging.debug("Looking for dummy files...") dummy_search_string = os.path.join(self.final_output_dir, "**dummy.txt") dummy_outputs = GoogleCloudHelper.ls(dummy_search_string) if len(dummy_outputs) > 0: cmd = "gsutil rm {0}".format(" ".join(dummy_outputs)) proc = sp.Popen(cmd, stderr=sp.PIPE, stdout=sp.PIPE, shell=True) proc.communicate() logging.debug("Done killing dummy files!") except: logging.warning( "(%s) Could not remove dummy input files on google cloud!") # Initiate destroy process on all the instances that haven't been destroyed for instance_name, instance_obj in self.processors.items(): try: if instance_name not in self.dealloc_procs: instance_obj.destroy(wait=False) except RuntimeError: logging.warning("(%s) Could not destroy instance!" % instance_name) # Now wait for all destroy processes to finish for instance_name, instance_obj in self.processors.items(): try: #if instance_obj.get_status() != Processor.OFF: if instance_name not in self.dealloc_procs: instance_obj.wait_process("destroy") except RuntimeError: logging.warning("(%s) Unable to destroy instance!" % instance_name) logging.info("Clean up complete!")
import importlib configure_import_paths() configure_logging(3) ss_file = "/home/alex/Desktop/projects/gap/test/test_runs/qc_report_merge/ss.json" ss = SampleSet(ss_file) print ss.get_paths() print ss.get_data(data_type="qc_report", samples="Jijoye_early2") print ss.get_data(data_type="qc_report", samples="Jijoye_early1") exit(0) ######################### Test GCH ls command print GoogleCloudHelper.ls("gs://derp_test/new_gap_test_1/**dummy.txt") print GoogleCloudHelper.ls("gs://derp_test/*gasdf") exit(0) ######################### Test GAPfile updating with modules from System.Platform.Google import GooglePlatform from System.Datastore import Datastore # Test cycle checking algorithm graph_file = "/home/alex/Desktop/projects/gap/test/test_runs/simple_success/graph.config" graph = Graph(graph_file) #print graph rk_file = "/home/alex/Desktop/projects/gap/test/test_runs/simple_success/rk.config" rk = ResourceKit(rk_file)