mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Rework summarizing histories on errors to include all datasets.
``` -------------------- >> begin captured stdout << --------------------- Problem in history with id adb5f5c93f827949 - summary of datasets below. -------------------------------------- | 1 - Test Dataset (HID - NAME) | Dataset State: | ok | Dataset Blurb: | 1 line | Dataset Info: | uploaded txt file | Peek: | <table cellspacing="0" cellpadding="3"><tr><td>1 2 3</td></tr></table> | Dataset Job Standard Output: | *Standard output was empty.* | Dataset Job Standard Error: | *Standard error was empty.* | -------------------------------------- | 2 - Test Dataset (HID - NAME) | Dataset State: | ok | Dataset Blurb: | 1 line | Dataset Info: | uploaded txt file | Peek: | <table cellspacing="0" cellpadding="3"><tr><td>4 5 6</td></tr></table> | Dataset Job Standard Output: | *Standard output was empty.* | Dataset Job Standard Error: | *Standard error was empty.* | -------------------------------------- | 3 - multi_data_param on data 1 and data 2 (HID - NAME) | Dataset State: | ok | Dataset Blurb: | 2 lines | Dataset Info: | *Dataset info is empty.* | Peek: | <table cellspacing="0" cellpadding="3"><tr><td>1 2 3</td></tr><tr><td>4 5 6</td></tr></table> | Dataset Job Standard Output: | *Standard output was empty.* | Dataset Job Standard Error: | *Standard error was empty.* | -------------------------------------- | 4 - multi_data_param on data 1 and data 2 (HID - NAME) | Dataset State: | ok | Dataset Blurb: | 2 lines | Dataset Info: | *Dataset info is empty.* | Peek: | <table cellspacing="0" cellpadding="3"><tr><td>4 5 6</td></tr><tr><td>1 2 3</td></tr></table> | Dataset Job Standard Output: | *Standard output was empty.* | Dataset Job Standard Error: | *Standard error was empty.* | -------------------------------------- ```
This commit is contained in:
+13
-13
@@ -327,7 +327,7 @@ class GalaxyInteractorApi( object ):
|
||||
return self._state_ready( state, error_msg="Job in error state." )
|
||||
except Exception:
|
||||
if VERBOSE_ERRORS:
|
||||
self._summarize_history_errors( history_id )
|
||||
self._summarize_history( history_id )
|
||||
raise
|
||||
|
||||
def __history_ready( self, history_id ):
|
||||
@@ -339,13 +339,13 @@ class GalaxyInteractorApi( object ):
|
||||
return self._state_ready( state, error_msg="History in error state." )
|
||||
except Exception:
|
||||
if VERBOSE_ERRORS:
|
||||
self._summarize_history_errors( history_id )
|
||||
self._summarize_history( history_id )
|
||||
raise
|
||||
|
||||
def _summarize_history_errors( self, history_id ):
|
||||
def _summarize_history( self, history_id ):
|
||||
if history_id is None:
|
||||
raise ValueError("_summarize_history_errors passed empty history_id")
|
||||
print("History with id %s in error - summary of datasets in error below." % history_id)
|
||||
raise ValueError("_summarize_history passed empty history_id")
|
||||
print("Problem in history with id %s - summary of datasets below." % history_id)
|
||||
try:
|
||||
history_contents = self.__contents( history_id )
|
||||
except Exception:
|
||||
@@ -354,8 +354,6 @@ class GalaxyInteractorApi( object ):
|
||||
for history_content in history_contents:
|
||||
|
||||
dataset = history_content
|
||||
if dataset.get( 'state', 'ok' ) != 'error':
|
||||
continue
|
||||
|
||||
print(ERROR_MESSAGE_DATASET_SEP)
|
||||
dataset_id = dataset.get( 'id', None )
|
||||
@@ -367,26 +365,28 @@ class GalaxyInteractorApi( object ):
|
||||
|
||||
try:
|
||||
dataset_info = self._dataset_info( history_id, dataset_id )
|
||||
print("| Dataset State:")
|
||||
print(self.format_for_summary(dataset_info.get("state"), "Dataset state is unknown."))
|
||||
print("| Dataset Blurb:")
|
||||
print(self.format_for_error( dataset_info.get( "misc_blurb", "" ), "Dataset blurb was empty." ))
|
||||
print(self.format_for_summary( dataset_info.get( "misc_blurb", "" ), "Dataset blurb was empty." ))
|
||||
print("| Dataset Info:")
|
||||
print(self.format_for_error( dataset_info.get( "misc_info", "" ), "Dataset info is empty." ))
|
||||
print(self.format_for_summary( dataset_info.get( "misc_info", "" ), "Dataset info is empty." ))
|
||||
print("| Peek:")
|
||||
print(self.format_for_error( dataset_info.get( "peek", ""), "Peek unavilable."))
|
||||
print(self.format_for_summary( dataset_info.get( "peek", ""), "Peek unavilable."))
|
||||
except Exception:
|
||||
print("| *TEST FRAMEWORK ERROR FETCHING DATASET DETAILS*")
|
||||
try:
|
||||
provenance_info = self._dataset_provenance( history_id, dataset_id )
|
||||
print("| Dataset Job Standard Output:")
|
||||
print(self.format_for_error( provenance_info.get( "stdout", "" ), "Standard output was empty." ))
|
||||
print(self.format_for_summary( provenance_info.get( "stdout", "" ), "Standard output was empty." ))
|
||||
print("| Dataset Job Standard Error:")
|
||||
print(self.format_for_error( provenance_info.get( "stderr", "" ), "Standard error was empty." ))
|
||||
print(self.format_for_summary( provenance_info.get( "stderr", "" ), "Standard error was empty." ))
|
||||
except Exception:
|
||||
print("| *TEST FRAMEWORK ERROR FETCHING JOB DETAILS*")
|
||||
print("|")
|
||||
print(ERROR_MESSAGE_DATASET_SEP)
|
||||
|
||||
def format_for_error( self, blob, empty_message, prefix="| " ):
|
||||
def format_for_summary( self, blob, empty_message, prefix="| " ):
|
||||
contents = "\n".join([ "%s%s" % (prefix, line.strip()) for line in StringIO(blob).readlines() if line.rstrip("\n\r") ] )
|
||||
return contents or "%s*%s*" % ( prefix, empty_message )
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class BaseDatasetPopulator( object ):
|
||||
try:
|
||||
return wait_on_state( lambda: self._get( "histories/%s" % history_id ), assert_ok=assert_ok, timeout=timeout )
|
||||
except AssertionError:
|
||||
self._summarize_history_errors( history_id )
|
||||
self._summarize_history( history_id )
|
||||
raise
|
||||
|
||||
def wait_for_job( self, job_id, assert_ok=False, timeout=DEFAULT_TIMEOUT ):
|
||||
@@ -101,7 +101,7 @@ class BaseDatasetPopulator( object ):
|
||||
def get_job_details( self, job_id, full=False ):
|
||||
return self._get( "jobs/%s?full=%s" % (job_id, full) )
|
||||
|
||||
def _summarize_history_errors( self, history_id ):
|
||||
def _summarize_history( self, history_id ):
|
||||
pass
|
||||
|
||||
@contextlib.contextmanager
|
||||
@@ -113,7 +113,7 @@ class BaseDatasetPopulator( object ):
|
||||
history_id = self.new_history()
|
||||
yield history_id
|
||||
except Exception:
|
||||
self._summarize_history_errors(history_id)
|
||||
self._summarize_history(history_id)
|
||||
raise
|
||||
|
||||
def new_history( self, **kwds ):
|
||||
@@ -230,8 +230,8 @@ class DatasetPopulator( BaseDatasetPopulator ):
|
||||
def _get( self, route ):
|
||||
return self.galaxy_interactor.get( route )
|
||||
|
||||
def _summarize_history_errors( self, history_id ):
|
||||
self.galaxy_interactor._summarize_history_errors( history_id )
|
||||
def _summarize_history( self, history_id ):
|
||||
self.galaxy_interactor._summarize_history( history_id )
|
||||
|
||||
def wait_for_dataset(self, history_id, dataset_id, assert_ok=False, timeout=DEFAULT_TIMEOUT):
|
||||
return wait_on_state(lambda: self._get("histories/%s/contents/%s" % (history_id, dataset_id)), assert_ok=assert_ok, timeout=timeout)
|
||||
|
||||
Reference in New Issue
Block a user