Skip to main content

Job workers

A job worker is a small Node process. It asks the API for work, runs it on ClassCAD through CC_URL, and uploads what comes back. It does:

JobWhat happens
part-deriveOpens a part, saves its SCG, measures it, renders its picture
assembly-buildBuilds an assembly from its asm.json, measures it, renders its picture
assembly-deriveThe same for a self-contained OFB assembly
assembly-export-ofb, assembly-export-stpWrites an assembly as one file
code-syncFetches a generator's code at a commit and reads its manifest
code-executeRuns a generator and uploads what it made

How many​

As many as you like. A job is handed to exactly one worker, so you can start several on one server or across several, all pointing at the same API and scheduler. A worker waits instead of failing when ClassCAD isn't reachable, so the order you start things in doesn't matter much.

Each worker runs one job at a time. Start roughly as many workers as you want jobs to run in parallel, and let the scheduler spread them over the engines.

Pictures​

Set CLASSCAD_RENDERER_DIR to the ClassCAD renderer and the worker renders a 512 × 512 picture of every part and assembly. It needs no browser and no GPU.

Generators​

A worker runs a generator as a child process: it bundles the generator with the SDK, starts it with Node in a fresh directory and gives it a ClassCAD session of its own. The process gets no credentials for the PDM or the database, and is stopped after RUN_TIMEOUT_S seconds.

It isn't a sandbox, though: the code can do what Node can do. Run only generators you trust. Isolated runs are planned before the release.