def _call_np_worker()

in community-artifacts/Deep-learning/Utilities/madlib_image_loader.py [0:0]


def _call_np_worker(data): # data = list of (x, y) or (x, y, num_images) tuples
    try:                   #        of length self.ROWS_PER_FILE
        if iloader.no_temp_files:
            iloader._just_load(data)
        else:
            iloader._write_tmp_file_and_load(data)
    except Exception as e:
        if iloader.tmp_dir:
            iloader.rm_temp_dir()
        # For some reason, when an exception is raised in a worker, the
        #  stack trace doesn't get shown.  So we have to print it ourselves
        #  (actual exception #  msg will get printed by mother process.
        #
        print "\nError in {0} while loading images".format(iloader.pr_name)
        print traceback.format_exc()
        raise e