def check_for_unknown(command_str, options): # if we get to this point we don't know what the user is requesting app = registry.get_app('unknown') options = [command_str] if app == None: raise Exception('App "Unknown" is missing') return pipeline.Command(app, options)
def intelligently_add_renderer(new_pipeline): # if pipeline.output == iotypes.Directory: # app = registry.get_app('go') if new_pipeline.preferred_renderer != None: app = registry.get_app(new_pipeline.preferred_renderer) if app == None: raise Exception('Preferred renderer ' + \ str(new_pipeline.preferred_renderer) + ' not found') elif new_pipeline.output == iotypes.Text: app = registry.get_app('html') elif new_pipeline.output == iotypes.File: app = registry.get_app('grid') else: raise Exception("Unexpected typing error; please check the code") renderer = pipeline.Command(app, []) new_pipeline.add(renderer)
def intelligently_add_start(new_pipeline): if new_pipeline.input == iotypes.File: app = registry.get_app('file') command = pipeline.Command(app, [os.getcwd()]) new_pipeline.add_to_start(command) else: print new_pipeline.describe() raise Exception( "Couldn't autowire an input of type " + str(new_pipeline.input.__name__))
def create_command(app_name, options): app = registry.get_app(app_name) command = pipeline.Command(app, options) return command
def check_for_app(command_str, options): app = registry.get_app(command_str) if app: return pipeline.Command(app, options)