Table of Contents

Class CellProcess

Namespace
KernLab.Cell
Assembly
KernLab.Cell.dll

容器进程托管(C203):spawn+stdout 端点自报解析+stderr 尾部 60 行取证+kill 树+ 资源翻译(cgroup v2/JobObject——执法者是 OS,Cell 只翻译与回收)+零孤儿(--parent-pid)。

public sealed class CellProcess : ICellContainerInstance, IAsyncDisposable
Inheritance
CellProcess
Implements
Inherited Members

Properties

ExitCode

退出码(未退出=null)。

public int? ExitCode { get; }

Property Value

int?

Id

OS 进程号(资源翻译/cgroup 口)。

public int Id { get; }

Property Value

int

IsAvailable

是否可接新调用(Ready 态)。

public bool IsAvailable { get; }

Property Value

bool

Spec

实例的规格(替补一致性校验用)。

public CellSpec Spec { get; }

Property Value

CellSpec

StderrTail

stderr 尾部(§8——60 行取证窗)。

public IReadOnlyList<string> StderrTail { get; }

Property Value

IReadOnlyList<string>

Methods

DisposeAsync()

public ValueTask DisposeAsync()

Returns

ValueTask

DrainAsync(TimeSpan, CancellationToken)

drain 并退场(世代轮换/替补时——在途收尾或窗口到期)。

public ValueTask DrainAsync(TimeSpan drainWindow, CancellationToken cancellationToken = default)

Parameters

drainWindow TimeSpan
cancellationToken CancellationToken

Returns

ValueTask

EndpointAsync(TimeSpan, CancellationToken)

容器自报端点(连接前等待)——子进程先死即失败并随异常外抛 stderr(不空等超时窗)。

public Task<CellEndpointDescriptor> EndpointAsync(TimeSpan timeout, CancellationToken cancellationToken = default)

Parameters

timeout TimeSpan
cancellationToken CancellationToken

Returns

Task<CellEndpointDescriptor>

KillTree()

kill 树(整进程树终止——零孤儿兜底)。

public void KillTree()

StartAsync(CellSpec, CellProcessStartOptions, CancellationToken)

启动(spawn+资源翻译+stdout/stderr 泵)。

public static Task<CellProcess> StartAsync(CellSpec spec, CellProcessStartOptions options, CancellationToken cancellationToken = default)

Parameters

spec CellSpec
options CellProcessStartOptions
cancellationToken CancellationToken

Returns

Task<CellProcess>

WaitForExitAsync(TimeSpan)

等待退出(超时=false)。

public Task<bool> WaitForExitAsync(TimeSpan timeout)

Parameters

timeout TimeSpan

Returns

Task<bool>

Events

Exited

进程退出(附退出码)。

public event Action<int?>? Exited

Event Type

Action<int?>

StdoutLine

宿主写半边观测(stdout 行——端点自报)。

public event Action<string>? StdoutLine

Event Type

Action<string>