Skip to content

Commit

Permalink
Merge branch 'master' into comment-publish-report
Browse files Browse the repository at this point in the history
  • Loading branch information
0x2b3bfa0 authored May 29, 2022
2 parents 36b6c6b + 95019fb commit afe8be5
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 70 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: 3.9
- run: pip install tensorboard
- run: |
pip install tensorboard
pip install -I protobuf==3.20.1
- run: npm ci
- run: npm run test
env:
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ requirement.
### Bitbucket

Please see our docs on
[CML with Bitbucket Cloud](https://github.com/iterative/cml/wiki/CML-with-Bitbucket-Cloud).
_Bitbucket Server support estimated to arrive by mid 2021._
[CML with Bitbucket Cloud](https://cml.dev/doc/usage?tab=Bitbucket).

### GitHub

Expand Down
74 changes: 34 additions & 40 deletions bin/cml/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const shutdown = async (opts) => {

try {
winston.info(`Unregistering runner ${name}...`);
RUNNER && RUNNER.kill('SIGINT');
await cml.unregisterRunner({ name });
RUNNER && RUNNER.kill('SIGINT');
winston.info('\tSuccess');
} catch (err) {
winston.error(`\tFailed: ${err.message}`);
Expand Down Expand Up @@ -69,6 +69,9 @@ const shutdown = async (opts) => {
const destroyTerraform = async () => {
if (!tfResource) return;

winston.info(`Waiting ${destroyDelay} seconds to destroy`);
await sleep(destroyDelay);

try {
winston.debug(await tf.destroy({ dir: tfPath }));
} catch (err) {
Expand All @@ -82,9 +85,6 @@ const shutdown = async (opts) => {
winston.info('runner status', { reason, status: 'terminated' });
}

winston.info(`waiting ${destroyDelay} seconds before exiting...`);
await sleep(destroyDelay);

if (!cloud) {
try {
await unregisterRunner();
Expand Down Expand Up @@ -125,47 +125,42 @@ const runCloud = async (opts) => {
cloudStartupScript: startupScript,
cloudAwsSecurityGroup: awsSecurityGroup,
cloudAwsSubnet: awsSubnet,
tfFile,
workdir
} = opts;

if (gpu === 'tesla')
winston.warn(
'GPU model "tesla" has been deprecated; please use "v100" instead.'
);

const tfPath = workdir;
const tfMainPath = join(tfPath, 'main.tf');

let tpl;
if (tfFile) {
tpl = await fs.writeFile(tfMainPath, await fs.readFile(tfFile));
} else {
if (gpu === 'tesla')
winston.warn(
'GPU model "tesla" has been deprecated; please use "v100" instead.'
);
tpl = tf.iterativeCmlRunnerTpl({
tpiVersion,
repo,
token,
driver,
labels,
cmlVersion,
idleTimeout,
name,
single,
cloud,
region,
type,
permissionSet,
metadata,
gpu: gpu === 'tesla' ? 'v100' : gpu,
hddSize,
sshPrivate,
spot,
spotPrice,
startupScript,
awsSecurityGroup,
awsSubnet,
dockerVolumes
});
}
const tpl = tf.iterativeCmlRunnerTpl({
tpiVersion,
repo,
token,
driver,
labels,
cmlVersion,
idleTimeout,
name,
single,
cloud,
region,
type,
permissionSet,
metadata,
gpu: gpu === 'tesla' ? 'v100' : gpu,
hddSize,
sshPrivate,
spot,
spotPrice,
startupScript,
awsSecurityGroup,
awsSubnet,
dockerVolumes
});

await fs.writeFile(tfMainPath, tpl);
await tf.init({ dir: tfPath });
Expand Down Expand Up @@ -432,7 +427,6 @@ exports.handler = async (opts) => {
await run(opts);
} catch (error) {
await shutdown({ ...opts, error });
throw error;
}
};

Expand Down
64 changes: 41 additions & 23 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"colors": "1.4.0"
},
"dependencies": {
"@actions/core": "^1.6.0",
"@actions/core": "^1.8.2",
"@actions/github": "^4.0.0",
"@npcz/magic": "^1.3.12",
"@octokit/core": "^3.5.1",
Expand All @@ -80,7 +80,7 @@
"fs-extra": "^9.1.0",
"git-url-parse": "^11.6.0",
"globby": "^11.0.4",
"https-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.1",
"js-base64": "^3.7.2",
"kebabcase-keys": "^1.0.0",
"mdast": "^3.0.0",
Expand All @@ -93,7 +93,7 @@
"remark-inline-links": "^6.0.1",
"remark-reference-links": "^6.0.1",
"semver": "^7.3.5",
"simple-git": "^3.5.0",
"simple-git": "^3.7.1",
"strip-ansi": "^6.0.1",
"strip-url-auth": "^1.0.1",
"tar": "^6.1.11",
Expand Down
4 changes: 3 additions & 1 deletion src/cml.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ class CML {
}

async unregisterRunner(opts = {}) {
const { id: runnerId } = await this.runnerByName(opts);
const { id: runnerId } = (await this.runnerByName(opts)) || {};
if (!runnerId) throw new Error(`Runner not found`);

return await getDriver(this).unregisterRunner({ runnerId, ...opts });
}

Expand Down

0 comments on commit afe8be5

Please sign in to comment.