Skip to content

Commit

Permalink
Release v0.4.1 (#542) (#543) (#537) (#540) (#545)
Browse files Browse the repository at this point in the history
* Fixes fake cml repo for bitbucket publish (#543)

* Fixes fake cml repo for bitbucket publish

* lazy driver

* cml-pr prs list (#542)

* cml-pr no branch sha

* no checkout back and prs fix

* checks if await is ok (#537)

* Rename --cloud-gpu tesla to v100 (#540)

* Add --cloud-gpu v100 option to cml-runner

* Add deprecation message for "tesla" GPU

* 0.4.1

Co-authored-by: Helio Machado <[email protected]>
  • Loading branch information
DavidGOrtega and 0x2b3bfa0 authored May 20, 2021
1 parent b8f402f commit 498fcd1
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stages:
deploy_job:
stage: deploy
when: always
image: dvcorg/cml
image: dvcorg/cml:0-dvc2-base1-gpu
script:
- cml-runner --cloud aws --cloud-region us-west --cloud-type g2.2xlarge
--cloud-spot --labels=cml-runner-gpu
Expand Down
8 changes: 6 additions & 2 deletions bin/cml-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ const run_cloud = async (opts) => {
if (tf_file) {
tpl = await fs.writeFile(tf_main_path, await fs.readFile(tf_file));
} else {
if (gpu === 'tesla')
console.log(
'GPU model "tesla" has been deprecated; please use "v100" instead.'
);
tpl = tf.iterative_cml_runner_tpl({
repo,
token,
Expand All @@ -157,7 +161,7 @@ const run_cloud = async (opts) => {
cloud,
region,
type,
gpu,
gpu: gpu.replace(/^tesla$/, 'v100'),
hdd_size,
ssh_private,
spot,
Expand Down Expand Up @@ -366,7 +370,7 @@ const opts = decamelize(
)
.default('cloud-gpu')
.describe('cloud-gpu', 'GPU type.')
.choices('cloud-gpu', ['nogpu', 'k80', 'tesla'])
.choices('cloud-gpu', ['nogpu', 'k80', 'v100', 'tesla'])
.coerce('cloud-gpu-type', (val) => (val === 'nogpu' ? null : val))
.default('cloud-hdd-size')
.describe('cloud-hdd-size', 'HDD size in GB')
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dvcorg/cml",
"version": "0.4.0",
"version": "0.4.1",
"author": {
"name": "DVC",
"url": "http://cml.dev"
Expand Down
47 changes: 21 additions & 26 deletions src/cml.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,11 @@ class CML {
}

async publish(opts = {}) {
const driver = get_driver(this);
const { title = '', md, native, gitlab_uploads, rm_watermark } = opts;

let mime, uri;
if (native || gitlab_uploads) {
({ mime, uri } = await driver.upload(opts));
({ mime, uri } = await get_driver(this).upload(opts));
} else {
({ mime, uri } = await upload(opts));
}
Expand Down Expand Up @@ -277,35 +276,31 @@ class CML {
if (branch_exists) {
const prs = await driver.prs();
const { url } =
prs.find((pr) => pr.source === source && pr.target === target) || {};
prs.find(
(pr) => source.endsWith(pr.source) && target.endsWith(pr.target)
) || {};

if (url) return render_pr(url);
} else {
try {
await exec(`git config --local user.email "${user_email}"`);
await exec(`git config --local user.name "${user_name}"`);

if (CI) {
if (this.driver === GITLAB) {
const repo = new URL(this.repo);
repo.password = this.token;
repo.username = driver.user_name;

await exec(`git remote rm ${remote}`);
await exec(`git remote add ${remote} "${repo.toString()}.git"`);
}
}
await exec(`git config --local user.email "${user_email}"`);
await exec(`git config --local user.name "${user_name}"`);

if (CI) {
if (this.driver === GITLAB) {
const repo = new URL(this.repo);
repo.password = this.token;
repo.username = driver.user_name;

await exec(`git checkout -B ${target} ${sha}`);
await exec(`git checkout -b ${source}`);
await exec(`git add ${paths.join(' ')}`);
await exec(`git commit -m "CML PR for ${sha_short} [skip ci]"`);
await exec(`git push --set-upstream ${remote} ${source}`);
await exec(`git checkout -B ${target} ${sha}`);
} catch (err) {
await exec(`git checkout -B ${target} ${sha}`);
throw err;
await exec(`git remote rm ${remote}`);
await exec(`git remote add ${remote} "${repo.toString()}.git"`);
}
}

await exec(`git checkout -B ${target} ${sha}`);
await exec(`git checkout -b ${source}`);
await exec(`git add ${paths.join(' ')}`);
await exec(`git commit -m "CML PR for ${sha_short} [skip ci]"`);
await exec(`git push --set-upstream ${remote} ${source}`);
}

const title = `CML PR for ${target} ${sha_short}`;
Expand Down
10 changes: 6 additions & 4 deletions src/drivers/bitbucket_cloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class BitBucketCloud {
this.token = token;
this.repo = repo;

const { protocol, host, pathname } = new URL(this.repo);
this.repo_origin = `${protocol}//${host}`;
this.api = 'https://api.bitbucket.org/2.0';
this.project_path = encodeURIComponent(pathname.substring(1));
if (repo !== 'cml') {
const { protocol, host, pathname } = new URL(this.repo);
this.repo_origin = `${protocol}//${host}`;
this.api = 'https://api.bitbucket.org/2.0';
this.project_path = encodeURIComponent(pathname.substring(1));
}
}

async comment_create(opts = {}) {
Expand Down

0 comments on commit 498fcd1

Please sign in to comment.