Exemple #1
0
def deploy_network():
    log.info("Deploying network")
    tar_file = deploy.package("rendered/nectar1/netkit/", "netkit")
    server = "trc1.trc.adelaide.edu.au"
    deploy.transfer(server, "sknight", tar_file, tar_file)
    print "server", server
    cd_dir = "rendered/nectar1/netkit/"
    deploy.extract(server, tar_file, cd_dir)
Exemple #2
0
def deploy_network():
    log.info("Deploying network")
    tar_file = deploy.package("rendered/nectar1/netkit/", "netkit")
    server = "trc1.trc.adelaide.edu.au"
    deploy.transfer(server, "sknight", tar_file, tar_file)
    print "server", server
    cd_dir = "rendered/nectar1/netkit/"
    deploy.extract(server, tar_file, cd_dir)
Exemple #3
0
def deploy_network(nidb):
    log.info("Deploying network")
    tar_file = deploy.package("rendered/nectar1/nklab/", "nklab")
    server = "trc1.trc.adelaide.edu.au"
    username = "******"

    server = "115.146.93.255" # 16 core
    server = "115.146.94.68" # 8 core
    username = "******"
    key_filename = "/Users/sk2/.ssh/sk.pem"
    
    deploy.transfer(server, username, tar_file, tar_file, key_filename)
    cd_dir = "rendered/nectar1/nklab/"
    deploy.extract(server, username, tar_file, cd_dir, timeout = 60, key_filename= key_filename)
Exemple #4
0
def deploy(head: str,
           version_dir: str,
           deploy_dir: str,
           download_url: str,
           archive_name: str,
           github_token: Optional[str] = None):
    with tempfile.TemporaryDirectory() as tempdir:
        # コンパイラをダウンロード
        header_args = ["-H", "Accept: application/octet-stream"]
        if github_token is not None:
            header_args += ["-H", f"Authorization: token {github_token}"]
        # なんかよく切断されるのでリトライを設定する
        header_args += ["--retry", "5"]

        archive_path = download(download_url, tempdir, archive_name,
                                header_args)

        # テンポラリディレクトリ上に解凍
        mkdir_p(version_dir)
        extract_path = extract(archive_path, tempdir)

        # バージョンファイルと本体を消して、解凍した新しいバージョンを配置する
        version_path = os.path.join(version_dir, head)
        if os.path.exists(version_path):
            with open(version_path, 'rb') as f:
                rm_rf(f.read().decode('utf-8'))
        rm_rf(version_path)

        mkdir_p(deploy_dir)
        deploy_path = os.path.join(deploy_dir, head)
        os.rename(extract_path, deploy_path)

        # デプロイ完了したのでバージョン情報とパスを書き込む
        with open(version_path, 'wb') as f:
            f.write(deploy_path.encode('utf-8'))