示例#1
0
def _apply_guild_patch():
    """Look in config cwd for guild_patch.py and load if exists."""
    patch_path = os.path.join(config.cwd(), "guild_patch.py")
    if os.path.exists(patch_path):
        from guild import python_util

        python_util.exec_script(patch_path)
示例#2
0
 def exec_script():
     mod_name, main_function = _env_module_name_and_function()
     script_globals = python_util.exec_script(path, globals, mod_name=mod_name)
     if main_function:
         try:
             module_main = script_globals[main_function]
         except KeyError:
             log.error("function %s not defined in %s", main_function, mod_name)
             sys.exit(1)
         else:
             module_main()
示例#3
0
 def exec_script():
     python_util.exec_script(path, globals)
示例#4
0
 def exec_script():
     mod_name = _module_name_for_info(module_info)
     log.debug("loading module from '%s'", module_info.mod_path)
     python_util.exec_script(module_info.mod_path,
                             globals,
                             mod_name=mod_name)
from guild import python_util

# Skip maybe_download_and_extract - we always expect the model to be
# available under --model_dir location.

python_util.exec_script("classify_image.py",
                        {"maybe_download_and_extract": lambda: None})
def _exec_module(mod_path, package):
    assert mod_path.endswith(".py"), mod_path
    sys.argv = [mod_path, "--help"]
    log.debug("loading module from '%s'", mod_path)
    python_util.exec_script(mod_path, mod_name=_exec_mod_name(package))