Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Almenon committed Jun 3, 2024
1 parent 82ce7bf commit ef2cf09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export enum PythonState {
FreshFree
}

export class PythonEvaluator {
export class PythonExecutor {
private static readonly areplPythonBackendFolderPath = __dirname + '/python/'

state: PythonState = PythonState.Starting
Expand Down Expand Up @@ -107,7 +107,7 @@ export class PythonEvaluator {
this.options.mode = 'binary'
this.options.stdio = ['pipe', 'pipe', 'pipe', 'pipe']
if (!options.pythonPath) this.options.pythonPath = PythonShell.defaultPythonPath
if (!options.scriptPath) this.options.scriptPath = PythonEvaluator.areplPythonBackendFolderPath
if (!options.scriptPath) this.options.scriptPath = PythonExecutor.areplPythonBackendFolderPath

this.evaluatorName = randomBytes(16).toString('hex')
}
Expand Down
6 changes: 3 additions & 3 deletions pythonEvaluators.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Options, PythonShell } from "python-shell";
import { ExecArgs, PythonEvaluator, PythonResult, PythonState } from ".";
import { ExecArgs, PythonExecutor, PythonResult, PythonState } from ".";

/**
* Starts multiple python executors for running user code.
* Will manage them for you, so you can treat this class
* as a single executor.
*/
export class PythonExecutors {
private executors: PythonEvaluator[]
private executors: PythonExecutor[]
private currentExecutorIndex: number = 0
private waitForFreeExecutor: NodeJS.Timeout

Expand All @@ -18,7 +18,7 @@ export class PythonExecutors {
if(this.executors.length != 0) throw Error('already started!')

for(let i=0;i++;i<numExecutors){
const pyExecutor = new PythonEvaluator(options)
const pyExecutor = new PythonExecutor(options)
pyExecutor.start(()=>{})
pyExecutor.evaluatorName = i.toString()
pyExecutor.onResult = result => {
Expand Down

0 comments on commit ef2cf09

Please sign in to comment.