Skip to content

Commit

Permalink
Merge branch 'master' into telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidGOrtega authored Aug 10, 2022
2 parents 3b8d1ea + f8584cc commit 7e74df6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 39 deletions.
1 change: 0 additions & 1 deletion bin/cml/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,6 @@ exports.builder = (yargs) =>
},
cloudSshPrivate: {
type: 'string',
coerce: (val) => val && val.replace(/\n/g, '\\n'),
description:
'Custom private RSA SSH key. If not provided an automatically generated throwaway key will be used'
},
Expand Down
4 changes: 2 additions & 2 deletions 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.17.1",
"version": "0.17.3",
"description": "<p align=\"center\"> <img src=\"https://static.iterative.ai/img/cml/title_strip_trim.png\" width=400> </p>",
"author": {
"name": "Iterative Inc",
Expand Down
75 changes: 40 additions & 35 deletions src/terraform.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require('fs').promises;
const { ltr } = require('semver');
const winston = require('winston');
const { exec, tfCapture } = require('./utils');

const MIN_TF_VER = '0.14.0';
Expand Down Expand Up @@ -77,43 +78,47 @@ const iterativeProviderTpl = ({ tpiVersion }) => ({
}
});

const iterativeCmlRunnerTpl = (opts = {}) => ({
...iterativeProviderTpl(opts),
resource: {
iterative_cml_runner: {
runner: {
...(opts.awsSecurityGroup && {
aws_security_group: opts.awsSecurityGroup
}),
...(opts.awsSubnet && { aws_subnet: opts.awsSubnet }),
...(opts.cloud && { cloud: opts.cloud }),
...(opts.cmlVersion && { cml_version: opts.cmlVersion }),
...(opts.dockerVolumes && { docker_volumes: opts.dockerVolumes }),
...(opts.driver && { driver: opts.driver }),
...(opts.gpu && { instance_gpu: opts.gpu }),
...(opts.hddSize && { instance_hdd_size: opts.hddSize }),
...(typeof opts.idleTimeout !== 'undefined' && {
idle_timeout: opts.idleTimeout
}),
...(opts.labels && { labels: opts.labels }),
...(opts.metadata && { metadata: opts.metadata }),
...(opts.name && { name: opts.name }),
...(opts.permissionSet && {
instance_permission_set: opts.permissionSet
}),
...(opts.region && { region: opts.region }),
...(opts.repo && { repo: opts.repo }),
...(opts.single && { single: opts.single }),
...(opts.spot && { spot: opts.spot }),
...(opts.spotPrice && { spot_price: opts.spotPrice }),
...(opts.sshPrivate && { ssh_private: opts.sshPrivate }),
...(opts.startupScript && { startup_script: opts.startupScript }),
...(opts.token && { token: opts.token }),
...(opts.type && { instance_type: opts.type })
const iterativeCmlRunnerTpl = (opts = {}) => {
const tfObj = {
...iterativeProviderTpl(opts),
resource: {
iterative_cml_runner: {
runner: {
...(opts.awsSecurityGroup && {
aws_security_group: opts.awsSecurityGroup
}),
...(opts.awsSubnet && { aws_subnet_id: opts.awsSubnet }),
...(opts.cloud && { cloud: opts.cloud }),
...(opts.cmlVersion && { cml_version: opts.cmlVersion }),
...(opts.dockerVolumes && { docker_volumes: opts.dockerVolumes }),
...(opts.driver && { driver: opts.driver }),
...(opts.gpu && { instance_gpu: opts.gpu }),
...(opts.hddSize && { instance_hdd_size: opts.hddSize }),
...(typeof opts.idleTimeout !== 'undefined' && {
idle_timeout: opts.idleTimeout
}),
...(opts.labels && { labels: opts.labels }),
...(opts.metadata && { metadata: opts.metadata }),
...(opts.name && { name: opts.name }),
...(opts.permissionSet && {
instance_permission_set: opts.permissionSet
}),
...(opts.region && { region: opts.region }),
...(opts.repo && { repo: opts.repo }),
...(opts.single && { single: opts.single }),
...(opts.spot && { spot: opts.spot }),
...(opts.spotPrice && { spot_price: opts.spotPrice }),
...(opts.sshPrivate && { ssh_private: opts.sshPrivate }),
...(opts.startupScript && { startup_script: opts.startupScript }),
...(opts.token && { token: opts.token }),
...(opts.type && { instance_type: opts.type })
}
}
}
}
});
};
winston.debug(`terraform data: ${JSON.stringify(tfObj)}`);
return tfObj;
};

const checkMinVersion = async () => {
const ver = await version();
Expand Down

1 comment on commit 7e74df6

@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.