rmprocs

rmprocs(pids...)

Removes the specified workers.

Examples

  1. Remove specific worker processes:
    
    julia> workers()
    4-element Vector{Int64}:
    2
    3
    4
    5

julia> rmprocs(2, 5) 2-element Vector{Int64}: 3 4

julia> workers() 2-element Vector{Int64}: 3 4

In this example, the worker processes with IDs 2 and 5 are removed using `rmprocs`. After removal, the remaining workers are listed using `workers()`.

2. **Remove all worker processes:**
```julia
julia> workers()
4-element Vector{Int64}:
 2
 3
 4
 5

julia> rmprocs(workers())
0-element Vector{Int64}

julia> workers()
0-element Vector{Int64}

This example demonstrates how to remove all worker processes by passing the workers() array to rmprocs. After removal, the workers() array becomes empty.

Common mistake example:

julia> rmprocs(10)
ERROR: ArgumentError: worker with id 10 not found

In this example, the mistake is specifying a worker ID that does not exist. It is essential to provide valid worker IDs as arguments to rmprocs to avoid such errors.

See Also

addprocs, atexit, cd, clipboard, EnvHash, exit, getpid, peakflops, ProcessExitedException, process_exited, process_running, procs, quit, readandwrite, redirect_stdout, rmprocs, run, setenv, spawn, withenv,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: