diff --git a/api/src/job.js b/api/src/job.js index 46efe27..f4a8c05 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -146,7 +146,7 @@ class Job { '--nofile=' + this.runtime.max_open_files, '--fsize=' + this.runtime.max_file_size, ]; - + const timeout_call = [ 'timeout', '-s', @@ -158,7 +158,7 @@ class Job { prlimit.push('--as=' + memory_limit); } - const proc_call = [ + const proc_call = [ 'nice', ...timeout_call, ...prlimit, @@ -204,16 +204,7 @@ class Job { (timeout >= 0 && set_timeout(async _ => { this.logger.info(`Timeout exceeded timeout=${timeout}`); - try { - process.kill(proc.pid, 'SIGKILL'); - } - catch (e) { - // Could already be dead and just needs to be waited on - this.logger.debug( - `Got error while SIGKILLing process ${proc}:`, - e - ); - } + process.kill(proc.pid, 'SIGKILL'); }, timeout)) || null; this.#active_timeouts.push(kill_timeout); @@ -223,16 +214,7 @@ class Job { event_bus.emit('stderr', data); } else if (stderr.length > this.runtime.output_max_size) { this.logger.info(`stderr length exceeded`); - try { - process.kill(proc.pid, 'SIGKILL'); - } - catch (e) { - // Could already be dead and just needs to be waited on - this.logger.debug( - `Got error while SIGKILLing process ${proc}:`, - e - ); - } + process.kill(proc.pid, 'SIGKILL'); } else { stderr += data; output += data; @@ -244,16 +226,7 @@ class Job { event_bus.emit('stdout', data); } else if (stdout.length > this.runtime.output_max_size) { this.logger.info(`stdout length exceeded`); - try { - process.kill(proc.pid, 'SIGKILL'); - } - catch (e) { - // Could already be dead and just needs to be waited on - this.logger.debug( - `Got error while SIGKILLing process ${proc}:`, - e - ); - } + process.kill(proc.pid, 'SIGKILL'); } else { stdout += data; output += data; @@ -281,7 +254,7 @@ class Job { if (this.state !== job_states.PRIMED) { throw new Error( 'Job must be in primed state, current state: ' + - this.state.toString() + this.state.toString() ); } @@ -298,22 +271,22 @@ class Job { const { emit_event_bus_result, emit_event_bus_stage } = event_bus === null ? { - emit_event_bus_result: () => { }, - emit_event_bus_stage: () => { }, - } + emit_event_bus_result: () => {}, + emit_event_bus_stage: () => {}, + } : { - emit_event_bus_result: (stage, result, event_bus) => { - const { error, code, signal } = result; - event_bus.emit('exit', stage, { - error, - code, - signal, - }); - }, - emit_event_bus_stage: (stage, event_bus) => { - event_bus.emit('stage', stage); - }, - }; + emit_event_bus_result: (stage, result, event_bus) => { + const { error, code, signal } = result; + event_bus.emit('exit', stage, { + error, + code, + signal, + }); + }, + emit_event_bus_stage: (stage, event_bus) => { + event_bus.emit('stage', stage); + }, + }; if (this.runtime.compiled) { this.logger.debug('Compiling'); @@ -379,9 +352,9 @@ class Job { const [_, ruid, euid, suid, fuid] = uid_line.split(/\s+/); const [_1, state, user_friendly] = state_line.split(/\s+/); - + const proc_id_int = parse_int(proc_id); - + // Skip over any processes that aren't ours. if (ruid != this.uid && euid != this.uid) return -1; @@ -389,7 +362,7 @@ class Job { // Zombie process, just needs to be waited, regardless of the user id if (!to_wait.includes(proc_id_int)) to_wait.push(proc_id_int); - + return -1; } // We should kill in all other state (Sleep, Stopped & Running) @@ -424,7 +397,7 @@ class Job { // Then clear them out of the process tree try { process.kill(proc, 'SIGKILL'); - } catch (e) { + } catch { // Could already be dead and just needs to be waited on this.logger.debug( `Got error while SIGKILLing process ${proc}:`, diff --git a/packages/crystal/1.9.2/build.sh b/packages/crystal/0.36.1/build.sh old mode 100644 new mode 100755 similarity index 72% rename from packages/crystal/1.9.2/build.sh rename to packages/crystal/0.36.1/build.sh index e95779c..ba10f3f --- a/packages/crystal/1.9.2/build.sh +++ b/packages/crystal/0.36.1/build.sh @@ -2,6 +2,6 @@ PREFIX=$(realpath $(dirname $0)) -curl -L "https://github.com/crystal-lang/crystal/releases/download/1.9.2/crystal-1.9.2-1-linux-x86_64.tar.gz" -o crystal.tar.gz +curl -L "https://github.com/crystal-lang/crystal/releases/download/0.36.1/crystal-0.36.1-1-linux-x86_64.tar.gz" -o crystal.tar.gz tar xzf crystal.tar.gz --strip-components=1 rm crystal.tar.gz diff --git a/packages/crystal/1.9.2/compile b/packages/crystal/0.36.1/compile similarity index 100% rename from packages/crystal/1.9.2/compile rename to packages/crystal/0.36.1/compile diff --git a/packages/crystal/1.9.2/environment b/packages/crystal/0.36.1/environment similarity index 100% rename from packages/crystal/1.9.2/environment rename to packages/crystal/0.36.1/environment diff --git a/packages/crystal/1.9.2/metadata.json b/packages/crystal/0.36.1/metadata.json similarity index 71% rename from packages/crystal/1.9.2/metadata.json rename to packages/crystal/0.36.1/metadata.json index 09a23ad..ee995eb 100644 --- a/packages/crystal/1.9.2/metadata.json +++ b/packages/crystal/0.36.1/metadata.json @@ -1,5 +1,5 @@ { "language": "crystal", - "version": "1.9.2", + "version": "0.36.1", "aliases": ["crystal", "cr"] } diff --git a/packages/crystal/1.9.2/run b/packages/crystal/0.36.1/run similarity index 100% rename from packages/crystal/1.9.2/run rename to packages/crystal/0.36.1/run diff --git a/packages/crystal/1.9.2/test.cr b/packages/crystal/0.36.1/test.cr similarity index 100% rename from packages/crystal/1.9.2/test.cr rename to packages/crystal/0.36.1/test.cr diff --git a/packages/python/3.11.0/build.sh b/packages/python/3.11.0/build.sh deleted file mode 100644 index 8db680c..0000000 --- a/packages/python/3.11.0/build.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -PREFIX=$(realpath $(dirname $0)) - -mkdir -p build - -cd build - -curl "https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz" -o python.tar.gz -tar xzf python.tar.gz --strip-components=1 -rm python.tar.gz - -./configure --prefix "$PREFIX" --with-ensurepip=install -make -j$(nproc) -make install -j$(nproc) - -cd .. - -rm -rf build - -bin/pip3 install numpy scipy pandas pycryptodome whoosh bcrypt passlib sympy xxhash base58 cryptography PyNaCl diff --git a/packages/python/3.11.0/environment b/packages/python/3.11.0/environment deleted file mode 100644 index 977a5e8..0000000 --- a/packages/python/3.11.0/environment +++ /dev/null @@ -1 +0,0 @@ -export PATH=$PWD/bin:$PATH diff --git a/packages/python/3.11.0/metadata.json b/packages/python/3.11.0/metadata.json deleted file mode 100644 index c169a60..0000000 --- a/packages/python/3.11.0/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "python", - "version": "3.11.0", - "aliases": ["py", "py3", "python3", "python3.11"] -} diff --git a/packages/python/3.11.0/run b/packages/python/3.11.0/run deleted file mode 100644 index cf38089..0000000 --- a/packages/python/3.11.0/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -python3.11 "$@" diff --git a/packages/python/3.11.0/test.py b/packages/python/3.11.0/test.py deleted file mode 100644 index 1784bfa..0000000 --- a/packages/python/3.11.0/test.py +++ /dev/null @@ -1,7 +0,0 @@ -working = True - -match working: - case True: - print("OK") - case False: - print()