Class BaseSchedulableTask
Base class for schedulable tasks.
Inherited Members
Namespace: Cognite.Extractor.Utils.Unstable.Tasks
Assembly: ExtractorUtils.dll
Syntax
public abstract class BaseSchedulableTask
Properties
| Edit this page View SourceErrorIsFatal
Return whether this task failing should be considered fatal and terminate the task scheduler completely.
Declaration
public abstract bool ErrorIsFatal { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Metadata
Provide metadata about the task, reported to integration during startup.
Declaration
public abstract TaskMetadata Metadata { get; }
Property Value
| Type | Description |
|---|---|
| TaskMetadata |
Name
Unique name of the task.
Declaration
public abstract string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
ReadyCallback
Callback registered on task startup, should be called to notify the task runner that this task is now ready to run.
Declaration
protected Action? ReadyCallback { get; }
Property Value
| Type | Description |
|---|---|
| Action |
Schedule
Task schedule, how often it runs automatically. Should be null if the task only runs manually or on startup.
Declaration
public virtual ITimeSpanProvider? Schedule { get; }
Property Value
| Type | Description |
|---|---|
| ITimeSpanProvider |
Methods
| Edit this page View SourceCanRunNow()
Return whether the task can run now.
The task should make sure to call the callback provided in RegisterReadyCallback
once this will return true.
Once this returns true, the task may be started immediately.
Note that this may be called frequently, and should not do any expensive calculations.
Declaration
public abstract bool CanRunNow()
Returns
| Type | Description |
|---|---|
| bool |
RegisterReadyCallback(Action)
Register a callback that should be invoked once CanRunNow returns true.
You may call this callback even if CanRunNow isn't guaranteed to return true.
Declaration
public virtual void RegisterReadyCallback(Action callback)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | callback |
Run(BaseErrorReporter, CancellationToken)
Run the task, this may throw an exception which is treated as a fatal error.
Declaration
public abstract Task<TaskUpdatePayload?> Run(BaseErrorReporter task, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| BaseErrorReporter | task | Callbacks for reporting errors. |
| CancellationToken | token | Optional cancellation token. |
Returns
| Type | Description |
|---|---|
| Task<TaskUpdatePayload> |