Skip to content

GME Executor Framework

Patrik Meijer edited this page Dec 7, 2017 · 16 revisions

Webgme contains an optional middle-ware for handling of executor workers. This allows external machines to register and receive jobs created using the Executor Client API.

Source code documentation for Executor Client.

Scenario for using executor

You have a plugin that generates some configuration or executable code from models in your domain. Instead of manually downloading the files and typing in a command, you want the plugin to execute the code and return back some results (either as a plugin-message or notification, or persist it back to the model).

Running a task using a plugin

Plugins can be configured to run on the server by first allowing server execution on the server from the gme-config and then restricting the particular plugin from running in side browser by setting disableBrowserSideExecution to true it its metadata.json. When a plugin is executed in a nodejs-process on the server it has full accesses to the file-system and can spawn processes as it wishes.

An example of plugin generating some script or consumable resource and invokes a different application can be found at here. (N.B. this particular example uses [child-process-promise](https://www.npmjs.com/package/child-process-promise module) which wraps the API functions from the standard child_process module in promises.)

For smaller applications this is a feasible solution for the problem described. However plugins running on the server are bound by the resources available on the server machine and the configured bound of maximum workers.

Scaling up the tasks

When the resources on the server aren't enough the Executor framework can be used to attach workers from other machines. Note that a job is defined by a single command, but any resources including scripts can be uploaded to a worker as part of a created job.

some

  1. Enable the executor framework on the server from the gme-config.
  2. Attaching an executor-worker - clone or install executor-worker and follow the instructions in the repo.
  3. Create a job from the plugin using the ExecutorClient. See example at ExecutorPlugin.js.

Clone this wiki locally