MCPcopy Create free account
hub / github.com/engineer-man/piston / execute

Method execute

api/src/executor/job.js:151–184  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149 }
150
151 async execute() {
152 if (this.state !== job_states.PRIMED) {
153 throw new Error('Job must be in primed state, current state: ' + this.state.toString());
154 }
155
156 logger.info(`Executing job uuid=${this.uuid} uid=${this.uid} gid=${this.gid} runtime=${this.runtime.toString()}`);
157
158 logger.debug('Compiling');
159
160 let compile;
161
162 if (this.runtime.compiled) {
163 compile = await this.safe_call(
164 path.join(this.runtime.pkgdir, 'compile'),
165 this.files.map(x => x.name),
166 this.timeouts.compile
167 );
168 }
169
170 logger.debug('Running');
171
172 const run = await this.safe_call(
173 path.join(this.runtime.pkgdir, 'run'),
174 [this.main, ...this.args],
175 this.timeouts.run
176 );
177
178 this.state = job_states.EXECUTED;
179
180 return {
181 compile,
182 run
183 };
184 }
185
186 async cleanup() {
187 logger.info(`Cleaning up job uuid=${this.uuid}`);

Callers 1

run_jobFunction · 0.95

Calls 2

safe_callMethod · 0.95
toStringMethod · 0.80

Tested by

no test coverage detected