Skip to content

Commit

Permalink
Fixes controller hiding InitializationFailed
Browse files Browse the repository at this point in the history
When handle_invalid_pipeline() enables a package, it did not print out
the package initialization errors.
  • Loading branch information
remram44 committed Jul 27, 2015
1 parent e0e1c19 commit 32c7129
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions vistrails/core/vistrail/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -3286,6 +3286,21 @@ def create_upgrade_action(self, actions):

def handle_invalid_pipeline(self, e, new_version, vistrail=None,
report_all_errors=False, force_no_delay=False):
def check_exceptions(exception_set):
unhandled_exceptions = []
for err in exception_set:
if isinstance(err, InvalidPipeline):
sub_exceptions = check_exceptions(err.get_exception_set())
if len(sub_exceptions) > 0:
new_err = InvalidPipeline(sub_exceptions,
err._pipeline,
err._version)
unhandled_exceptions.append(new_err)
else:
if not err._was_handled:
unhandled_exceptions.append(err)
return unhandled_exceptions

load_other_versions = False
# print 'running handle_invalid_pipeline'
if vistrail is None:
Expand Down Expand Up @@ -3341,7 +3356,7 @@ def process_missing_packages(exception_set):
for err in missing_packages[identifier]:
err._was_handled = True
except Exception, new_e:
print '&&& hit other exception'
debug.unexpected_exception(new_e)
new_exceptions.append(new_e)
if not report_all_errors:
raise new_e
Expand All @@ -3352,8 +3367,8 @@ def process_missing_packages(exception_set):
# else assume the package was already enabled

if len(new_exceptions) > 0:
# got new exceptions
pass
raise InvalidPipeline(check_exceptions(root_exceptions) + new_exceptions,
e._pipeline, new_version)

def process_package_versions(exception_set):
for err in exception_set:
Expand Down Expand Up @@ -3453,6 +3468,7 @@ def process_package_exceptions(exception_set, pipeline):
for err in err_list:
err._was_handled = True
except Exception, new_e:
debug.unexpected_exception(new_e)
new_exceptions.append(new_e)
if not report_all_errors:
return new_actions
Expand Down Expand Up @@ -3487,8 +3503,7 @@ def process_package_exceptions(exception_set, pipeline):
new_actions.extend(actions)
err._was_handled = True
except Exception, new_e:
import traceback
traceback.print_exc()
debug.unexpected_exception(new_e)
new_exceptions.append(new_e)

if pkg.can_handle_missing_modules():
Expand All @@ -3513,6 +3528,7 @@ def process_package_exceptions(exception_set, pipeline):
new_actions.extend(actions)
err._was_handled = True
except Exception, new_e:
debug.unexpected_exception(new_e)
new_exceptions.append(new_e)
if not report_all_errors:
return new_actions
Expand Down Expand Up @@ -3607,27 +3623,10 @@ def process_package_exceptions(exception_set, pipeline):
self.set_changed(True)
self.recompute_terse_graph()

def check_exceptions(exception_set):
unhandled_exceptions = []
for err in exception_set:
if isinstance(err, InvalidPipeline):
sub_exceptions = check_exceptions(err.get_exception_set())
if len(sub_exceptions) > 0:
new_err = InvalidPipeline(sub_exceptions,
err._pipeline,
err._version)
unhandled_exceptions.append(new_err)
else:
if not err._was_handled:
unhandled_exceptions.append(err)
return unhandled_exceptions

left_exceptions = check_exceptions(root_exceptions)
if len(left_exceptions) > 0 or len(new_exceptions) > 0:
e = InvalidPipeline(left_exceptions + new_exceptions,
cur_pipeline, new_version)
debug.format_exception(e)
raise e
raise InvalidPipeline(left_exceptions + new_exceptions,
cur_pipeline, new_version)
return (new_version, cur_pipeline)

def validate(self, pipeline, raise_exception=True):
Expand Down

0 comments on commit 32c7129

Please sign in to comment.