コード例 #1
0
ファイル: batch_util.py プロジェクト: yuanbw/guildai
 def _make_trial_link(self, trial_run):
     """Creates a link in batch run dir to trial."""
     trial_link = self._trial_link()
     rel_trial_path = os.path.relpath(trial_run.path,
                                      os.path.dirname(trial_link))
     util.ensure_deleted(trial_link)
     os.symlink(rel_trial_path, trial_link)
コード例 #2
0
def _export_runs_to_gist_archives(runs, gist_repo):
    with util.TempDir("guild-runs-export-") as tmp:
        archives = [_run_export_archive(run, tmp.path) for run in runs]
        _export_runs(zip(runs, archives))
        for archive_src in archives:
            archive_dest = os.path.join(gist_repo, os.path.basename(archive_src))
            util.ensure_deleted(archive_dest)
            shutil.move(archive_src, archive_dest)
コード例 #3
0
def _link_to_trial(batch_run, trial_run):
    trial_link = os.path.join(batch_run.dir, trial_run.id)
    rel_trial_path = os.path.relpath(trial_run.dir,
                                     os.path.dirname(trial_link))
    util.ensure_deleted(trial_link)
    if os.name == 'nt':
        _windows_symlink(rel_trial_path, trial_path)
    else:
        os.symlink(rel_trial_path, trial_link)
コード例 #4
0
ファイル: remote_util.py プロジェクト: wangsd01/guildai
def set_remote_lock(remote_run, remote_name, runs_dir=None):
    runs_dir = runs_dir or var.runs_dir()
    local_run_dir = os.path.join(runs_dir, remote_run.id)
    lock_file = os.path.join(local_run_dir, ".guild", "LOCK")
    remote_lock_file = os.path.join(local_run_dir, ".guild", "LOCK.remote")
    util.ensure_deleted(lock_file)
    util.ensure_deleted(remote_lock_file)
    if remote_run.status == "running":
        with open(remote_lock_file, "w") as f:
            f.write(remote_name)
    elif remote_run.status == "terminated":
        with open(lock_file, "w") as f:
            f.write("0")
コード例 #5
0
ファイル: service.py プロジェクト: yuanbw/guildai
def stop(name, title=None):
    log = logging.getLogger("guild")
    title = title or name
    pidfile = var.pidfile(name)
    if not os.path.exists(pidfile):
        raise NotRunning(name)
    try:
        pid = _read_pid(pidfile)
    except Exception:
        if log.getEffectiveLevel() <= logging.DEBUG:
            log.exception("reading %s", pidfile)
        log.info("%s has an invalid pidfile (%s) - deleting", title, pidfile)
        util.ensure_deleted(pidfile)
    else:
        try:
            proc = psutil.Process(pid)
        except psutil.NoSuchProcess:
            log.info("%s did not shut down cleanly - cleaning up", title)
            util.ensure_deleted(pidfile)
        else:
            log.info("Stopping %s (pid %i)", title, proc.pid)
            proc.terminate()
コード例 #6
0
def _link_to_trial(batch_run, trial_run):
    trial_link = os.path.join(batch_run.dir, trial_run.id)
    rel_trial_path = os.path.relpath(trial_run.dir,
                                     os.path.dirname(trial_link))
    util.ensure_deleted(trial_link)
    os.symlink(rel_trial_path, trial_link)
コード例 #7
0
ファイル: s3.py プロジェクト: wingkitlee0/guildai
 def _clear_local_meta_id(self):
     id_path = os.path.join(self.local_sync_dir, "meta-id")
     util.ensure_deleted(id_path)
コード例 #8
0
def clear_run_marker(run, marker):
    util.ensure_deleted(run.guild_path(marker))
コード例 #9
0
ファイル: op.py プロジェクト: yuanbw/guildai
def _delete_staged(run):
    util.ensure_deleted(run.guild_path("STAGED"))
コード例 #10
0
ファイル: op.py プロジェクト: yuanbw/guildai
def delete_pending(run):
    util.ensure_deleted(run.guild_path("PENDING"))
コード例 #11
0
ファイル: remote_util.py プロジェクト: hkennyv/guildai
def _ensure_deleted_locks(run_dir):
    util.ensure_deleted(_lock_file_path(run_dir))
    util.ensure_deleted(_remote_lock_file_path(run_dir))
コード例 #12
0
def _delete_gist_repo_run_archive(gist_repo, run_id):
    run_archive = os.path.join(gist_repo, _run_archive_filename(run_id))
    log.debug("deleting %s", run_archive)
    util.ensure_deleted(run_archive)
コード例 #13
0
def clear_local_meta_id(local_sync_dir):
    id_path = os.path.join(local_sync_dir, "meta-id")
    util.ensure_deleted(id_path)