* disable python exectution

* update prod url
This commit was merged in pull request #612.
This commit is contained in:
Kurt Hutten
2022-07-31 08:42:39 +10:00
committed by GitHub
parent 8500d223d4
commit f61280ef00
4 changed files with 34 additions and 33 deletions

View File

@@ -41,8 +41,8 @@ RUN npm install aws-lambda-ric@1.0.0
RUN conda --version RUN conda --version
# Install CadQuery # Install CadQuery
RUN conda install -c cadquery -c conda-forge cadquery=master ocp=7.5.2 python=3.8 # RUN conda install -c cadquery -c conda-forge cadquery=master ocp=7.5.2 python=3.8
RUN conda info # RUN conda info
# Get a copy of cq-cli from GitHub # Get a copy of cq-cli from GitHub
RUN git clone https://github.com/CadQuery/cq-cli.git RUN git clone https://github.com/CadQuery/cq-cli.git

View File

@@ -9,7 +9,7 @@ const stl = async (req, _context, callback) => {
console.log('eventBody', eventBody) console.log('eventBody', eventBody)
const { file, settings } = JSON.parse(eventBody) const { file, settings } = JSON.parse(eventBody)
const { error, consoleMessage, fullPath, tempFile } = await runCQ({ const { error, fullPath } = await runCQ({
file, file,
settings, settings,
}) })
@@ -17,8 +17,8 @@ const stl = async (req, _context, callback) => {
error, error,
callback, callback,
fullPath, fullPath,
consoleMessage, consoleMessage: '',
tempFile, tempFile : '',
}) })
} }

View File

@@ -30,31 +30,32 @@ export const runCQ = async ({
].join(' ') ].join(' ')
console.log('command', command) console.log('command', command)
let consoleMessage = '' let consoleMessage = ''
try { return { error: 'python execution currently disabled, see: https://github.com/Irev-Dev/cadhub/issues/611', fullPath }
consoleMessage = await runCommand(command, 30000) // try {
const params = JSON.parse( // consoleMessage = await runCommand(command, 30000)
await readFile(customizerPath, { encoding: 'ascii' }) // const params = JSON.parse(
) // await readFile(customizerPath, { encoding: 'ascii' })
await writeFiles( // )
[ // await writeFiles(
{ // [
file: JSON.stringify({ // {
customizerParams: params, // file: JSON.stringify({
consoleMessage, // customizerParams: params,
type: 'stl', // consoleMessage,
}), // type: 'stl',
fileName: 'metadata.json', // }),
}, // fileName: 'metadata.json',
], // },
tempFile // ],
) // tempFile
await runCommand( // )
`cat ${stlPath} /var/task/cadhub-concat-split /tmp/${tempFile}/metadata.json | gzip > ${fullPath}`, // await runCommand(
15000, // `cat ${stlPath} /var/task/cadhub-concat-split /tmp/${tempFile}/metadata.json | gzip > ${fullPath}`,
true // 15000,
) // true
return { consoleMessage, fullPath, tempFile } // )
} catch (error) { // return { consoleMessage, fullPath, tempFile }
return { error: consoleMessage || error, fullPath } // } catch (error) {
} // return { error: consoleMessage || error, fullPath }
// }
} }

View File

@@ -5,7 +5,7 @@ import type { Camera } from 'src/helpers/hooks/useIdeState'
export const lambdaBaseURL = export const lambdaBaseURL =
process.env.CAD_LAMBDA_BASE_URL || process.env.CAD_LAMBDA_BASE_URL ||
'https://oxt2p7ddgj.execute-api.us-east-1.amazonaws.com/prod' 'https://2inlbple1b.execute-api.us-east-1.amazonaws.com/prod2/'
export const stlToGeometry = (url) => export const stlToGeometry = (url) =>
new Promise((resolve, reject) => { new Promise((resolve, reject) => {