Skip to content

Commit

Permalink
Address Second Set of PR Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
darunrs committed Dec 20, 2023
1 parent 53217ce commit a2a4538
Show file tree
Hide file tree
Showing 9 changed files with 406 additions and 585 deletions.
1 change: 0 additions & 1 deletion runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM node:18.18.2 AS builder
WORKDIR /usr/src/app
COPY . .
RUN npm install
RUN npm run codegen
RUN npm run build

FROM node:18.18.2
Expand Down
2 changes: 1 addition & 1 deletion runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"scripts": {
"build": "rm -rf ./dist && npm run codegen && tsc",
"codegen": "npx proto-loader-gen-types --longs=String --enums=String --defaults --oneofs --grpcLib=@grpc/grpc-js --outDir=src/generated/ protos/runner.proto",
"codegen": "rm -rf ./src/generated && proto-loader-gen-types --longs=String --enums=String --defaults --oneofs --grpcLib=@grpc/grpc-js --outDir=src/generated/ protos/runner.proto",
"start": "npm run build && node dist/index.js",
"start:dev": "ts-node ./src/index.ts",
"start:docker": "node dist/index.js",
Expand Down
39 changes: 14 additions & 25 deletions runner/protos/runner.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,39 @@ syntax = "proto3";
package spec;

service Runner {
// Starts a new Runner stream worker
// Starts a new Runner executor
rpc StartExecutor (StartExecutorRequest) returns (StartExecutorResponse);

// Updates an existing Runner stream worker
rpc UpdateExecutor (UpdateExecutorRequest) returns (UpdateExecutorResponse);

// Stops an existing Runner stream worker
// Stops an existing Runner executor
rpc StopExecutor (StopExecutorRequest) returns (StopExecutorResponse);

// Lists all Runner stream workers
// Lists all Runner executor
rpc ListExecutors (ListExecutorsRequest) returns (ListExecutorsResponse);
}

// Start Executor Request
message StartExecutorRequest {
string stream_id = 1;
string executor_id = 1;
string redis_stream = 2;
string indexer_config = 3; // JSON containing code, schema, etc.
string account_id = 3;
string function_name = 4;
string code = 5;
string schema = 6;
}

// Start Executor Response
message StartExecutorResponse {
string stream_id = 1;
}

// Update Executor Request
message UpdateExecutorRequest {
string stream_id = 1;
string indexer_config = 2; // JSON containing code, schema, etc.
}

// Update Executor Response
message UpdateExecutorResponse {
string stream_id = 1;
string executor_id = 1;
}

// Stop Executor Request
message StopExecutorRequest {
string stream_id = 1;
string executor_id = 1;
}

// Stop Executor Response
message StopExecutorResponse {
string stream_id = 1;
string executor_id = 1;
}

// List Executor Request
Expand All @@ -54,13 +43,13 @@ message ListExecutorsRequest {

// List Executor Response
message ListExecutorsResponse {
// List of all streams, including stopped or crashed ones
repeated ExecutorInfo streams = 1;
// List of all executors, including stopped or crashed ones
repeated ExecutorInfo executors = 1;
}

// Information about a single BlockExecutor instance.
message ExecutorInfo {
string stream_id = 1;
string executor_id = 1;
string indexer_name = 2;
string status = 3;
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import StreamHandler from '../stream-handler/stream-handler';

const PROTO_PATH = 'protos/runner.proto';

export default function startServer (): grpc.Server {
export default function startRunnerServer (): grpc.Server {
const packageDefinition = protoLoader.loadSync(PROTO_PATH);
const runnerProto = (grpc.loadPackageDefinition(
packageDefinition
Expand All @@ -18,7 +18,7 @@ export default function startServer (): grpc.Server {

server.bindAsync(
'0.0.0.0:50007', // TODO: Read port from ENV
credentials.createInsecure(),
credentials.createInsecure(), // TODO: Use secure credentials with allow for Coordinator
(err: Error | null, port: number) => {
if (err) {
console.error(`Server error: ${err.message}`);
Expand Down
Loading

0 comments on commit a2a4538

Please sign in to comment.