Skip to content

Commit

Permalink
Partially revert "manual fixes"
Browse files Browse the repository at this point in the history
Partially reverts commit eca3a98
  • Loading branch information
casperdcl committed May 21, 2021
1 parent c144ae5 commit f7f945f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 38 deletions.
26 changes: 13 additions & 13 deletions bin/cml-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,26 @@ const shutdown = async (opts) => {
};

const runCloud = async (opts) => {
const { cloud_ssh_private_visible: cloudSshPrivateVisible } = opts;
const { cloudSshPrivateVisible } = opts;

const runTerraform = async (opts) => {
console.log('Terraform apply...');

const { token, repo, driver } = cml;
const {
labels,
idle_timeout: idleTimeout,
idleTimeout,
name,
single,
cloud,
cloud_region: region,
cloud_type: type,
cloud_gpu: gpu,
cloud_hdd_size: hddSize,
cloud_ssh_private: sshPrivate,
cloud_spot: spot,
cloud_spot_price: spotPrice,
cloud_startup_script: startupScript,
cloudRegion: region,
cloudType: type,
cloudGpu: gpu,
cloudHddSize: hddSize,
cloudSshPrivate: sshPrivate,
cloudSpot: spot,
cloudSpotPrice: spotPrice,
cloudStartupScript: startupScript,
tfFile,
workdir
} = opts;
Expand Down Expand Up @@ -203,14 +203,14 @@ const runCloud = async (opts) => {

const runLocal = async (opts) => {
console.log(`Launching ${cml.driver} runner`);
const { workdir, name, labels, single, idle_timeout: idleTimeout } = opts;
const { workdir, name, labels, single, idleTimeout } = opts;

const proc = await cml.startRunner({
workdir,
name,
labels,
single,
idle_timeout: idleTimeout
idleTimeout
});

const dataHandler = (data) => {
Expand Down Expand Up @@ -259,7 +259,7 @@ const run = async (opts) => {
labels,
name,
reuse,
tf_resource: tfResource
tfResource
} = opts;

cml = new CML({ driver, repo, token });
Expand Down
2 changes: 1 addition & 1 deletion bin/cml-tensorboard-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const run = async (opts) => {
name,
description,
title,
rm_watermark: rmWatermark
rmWatermark
} = opts;

// set credentials
Expand Down
18 changes: 6 additions & 12 deletions src/cml.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class CML {
async commentCreate(opts = {}) {
const {
report: userReport,
commit_sha: commitSha = await this.headSha(),
rm_watermark: rmWatermark
commitSha = await this.headSha(),
rmWatermark
} = opts;
const watermark = rmWatermark
? ''
Expand All @@ -108,19 +108,13 @@ class CML {
}

async checkCreate(opts = {}) {
const { head_sha: headSha = await this.headSha() } = opts;
const { headSha = await this.headSha() } = opts;

return await getDriver(this).checkCreate({ ...opts, headSha });
}

async publish(opts = {}) {
const {
title = '',
md,
native,
gitlab_uploads: gitlabUploads,
rm_watermark: rmWatermark
} = opts;
const { title = '', md, native, gitlabUploads, rmWatermark } = opts;

let mime, uri;
if (native || gitlabUploads) {
Expand Down Expand Up @@ -239,8 +233,8 @@ class CML {
const driver = getDriver(this);
const {
remote = GIT_REMOTE,
user_email: userEmail = GIT_USER_EMAIL,
user_name: userName = GIT_USER_NAME,
userEmail = GIT_USER_EMAIL,
userName = GIT_USER_NAME,
globs = ['dvc.lock', '.gitignore'],
md
} = opts;
Expand Down
14 changes: 4 additions & 10 deletions src/cml.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Github tests', () => {
test('Comment should succeed with a valid sha', async () => {
const report = '## Test comment';

await new CML({ repo: REPO }).commentCreate({ report, commit_sha: SHA });
await new CML({ repo: REPO }).commentCreate({ report, commitSha: SHA });
});

test('Comment should fail with a invalid sha', async () => {
Expand All @@ -69,10 +69,7 @@ describe('Github tests', () => {
const report = '## Test comment';
const commitSha = 'invalid_sha';

await new CML({ repo: REPO }).commentCreate({
report,
commit_sha: commitSha
});
await new CML({ repo: REPO }).commentCreate({ report, commitSha });
} catch (err) {
caughtErr = err.message;
}
Expand Down Expand Up @@ -184,7 +181,7 @@ describe('Gitlab tests', () => {

test('Comment should succeed with a valid sha', async () => {
const report = '## Test comment';
await new CML({ repo: REPO }).commentCreate({ report, commit_sha: SHA });
await new CML({ repo: REPO }).commentCreate({ report, commitSha: SHA });
});

test('Comment should fail with a invalid sha', async () => {
Expand All @@ -193,10 +190,7 @@ describe('Gitlab tests', () => {
const report = '## Test comment';
const commitSha = 'invalid_sha';

await new CML({ repo: REPO }).commentCreate({
report,
commit_sha: commitSha
});
await new CML({ repo: REPO }).commentCreate({ report, commitSha });
} catch (err) {
caughtErr = err.message;
}
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/gitlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class Gitlab {
}

async startRunner(opts) {
const { workdir, idle_timeout: idleTimeout, single, labels, name } = opts;
const { workdir, idleTimeout, single, labels, name } = opts;

let gpu = true;
try {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const mimeType = async (opts) => {
};

const fetchUploadData = async (opts) => {
const { path, buffer, mime_type: mimeTypeIn } = opts;
const { path, buffer, mimeType: mimeTypeIn } = opts;

const size = path ? (await fs.promises.stat(path)).size : buffer.length;
const data = path ? fs.createReadStream(path) : buffer;
Expand Down

2 comments on commit f7f945f

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

CML watermark

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

CML watermark

Please sign in to comment.