|
1 | 1 | const fs = require('fs').promises; |
2 | 2 | const { ltr } = require('semver'); |
| 3 | +const winston = require('winston'); |
3 | 4 | const { exec, tfCapture } = require('./utils'); |
4 | 5 |
|
5 | 6 | const MIN_TF_VER = '0.14.0'; |
@@ -77,43 +78,47 @@ const iterativeProviderTpl = ({ tpiVersion }) => ({ |
77 | 78 | } |
78 | 79 | }); |
79 | 80 |
|
80 | | -const iterativeCmlRunnerTpl = (opts = {}) => ({ |
81 | | - ...iterativeProviderTpl(opts), |
82 | | - resource: { |
83 | | - iterative_cml_runner: { |
84 | | - runner: { |
85 | | - ...(opts.awsSecurityGroup && { |
86 | | - aws_security_group: opts.awsSecurityGroup |
87 | | - }), |
88 | | - ...(opts.awsSubnet && { aws_subnet: opts.awsSubnet }), |
89 | | - ...(opts.cloud && { cloud: opts.cloud }), |
90 | | - ...(opts.cmlVersion && { cml_version: opts.cmlVersion }), |
91 | | - ...(opts.dockerVolumes && { docker_volumes: opts.dockerVolumes }), |
92 | | - ...(opts.driver && { driver: opts.driver }), |
93 | | - ...(opts.gpu && { instance_gpu: opts.gpu }), |
94 | | - ...(opts.hddSize && { instance_hdd_size: opts.hddSize }), |
95 | | - ...(typeof opts.idleTimeout !== 'undefined' && { |
96 | | - idle_timeout: opts.idleTimeout |
97 | | - }), |
98 | | - ...(opts.labels && { labels: opts.labels }), |
99 | | - ...(opts.metadata && { metadata: opts.metadata }), |
100 | | - ...(opts.name && { name: opts.name }), |
101 | | - ...(opts.permissionSet && { |
102 | | - instance_permission_set: opts.permissionSet |
103 | | - }), |
104 | | - ...(opts.region && { region: opts.region }), |
105 | | - ...(opts.repo && { repo: opts.repo }), |
106 | | - ...(opts.single && { single: opts.single }), |
107 | | - ...(opts.spot && { spot: opts.spot }), |
108 | | - ...(opts.spotPrice && { spot_price: opts.spotPrice }), |
109 | | - ...(opts.sshPrivate && { ssh_private: opts.sshPrivate }), |
110 | | - ...(opts.startupScript && { startup_script: opts.startupScript }), |
111 | | - ...(opts.token && { token: opts.token }), |
112 | | - ...(opts.type && { instance_type: opts.type }) |
| 81 | +const iterativeCmlRunnerTpl = (opts = {}) => { |
| 82 | + const tfObj = { |
| 83 | + ...iterativeProviderTpl(opts), |
| 84 | + resource: { |
| 85 | + iterative_cml_runner: { |
| 86 | + runner: { |
| 87 | + ...(opts.awsSecurityGroup && { |
| 88 | + aws_security_group: opts.awsSecurityGroup |
| 89 | + }), |
| 90 | + ...(opts.awsSubnet && { aws_subnet_id: opts.awsSubnet }), |
| 91 | + ...(opts.cloud && { cloud: opts.cloud }), |
| 92 | + ...(opts.cmlVersion && { cml_version: opts.cmlVersion }), |
| 93 | + ...(opts.dockerVolumes && { docker_volumes: opts.dockerVolumes }), |
| 94 | + ...(opts.driver && { driver: opts.driver }), |
| 95 | + ...(opts.gpu && { instance_gpu: opts.gpu }), |
| 96 | + ...(opts.hddSize && { instance_hdd_size: opts.hddSize }), |
| 97 | + ...(typeof opts.idleTimeout !== 'undefined' && { |
| 98 | + idle_timeout: opts.idleTimeout |
| 99 | + }), |
| 100 | + ...(opts.labels && { labels: opts.labels }), |
| 101 | + ...(opts.metadata && { metadata: opts.metadata }), |
| 102 | + ...(opts.name && { name: opts.name }), |
| 103 | + ...(opts.permissionSet && { |
| 104 | + instance_permission_set: opts.permissionSet |
| 105 | + }), |
| 106 | + ...(opts.region && { region: opts.region }), |
| 107 | + ...(opts.repo && { repo: opts.repo }), |
| 108 | + ...(opts.single && { single: opts.single }), |
| 109 | + ...(opts.spot && { spot: opts.spot }), |
| 110 | + ...(opts.spotPrice && { spot_price: opts.spotPrice }), |
| 111 | + ...(opts.sshPrivate && { ssh_private: opts.sshPrivate }), |
| 112 | + ...(opts.startupScript && { startup_script: opts.startupScript }), |
| 113 | + ...(opts.token && { token: opts.token }), |
| 114 | + ...(opts.type && { instance_type: opts.type }) |
| 115 | + } |
113 | 116 | } |
114 | 117 | } |
115 | | - } |
116 | | -}); |
| 118 | + }; |
| 119 | + winston.debug(`terraform data: ${JSON.stringify(tfObj)}`); |
| 120 | + return tfObj; |
| 121 | +}; |
117 | 122 |
|
118 | 123 | const checkMinVersion = async () => { |
119 | 124 | const ver = await version(); |
|
0 commit comments