Show / Hide Table of Contents

Class BaseSchedulableTask

Base class for schedulable tasks.

Inheritance
object
BaseSchedulableTask
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Cognite.Extractor.Utils.Unstable.Tasks
Assembly: ExtractorUtils.dll
Syntax
public abstract class BaseSchedulableTask

Properties

| Edit this page View Source

CancellationIsFatal

Return whether this task being cancelled via an explicit Stop action (CancelTask(string, string?)) should be considered fatal, on the same terms as ErrorIsFatal.

Defaults to ErrorIsFatal: a task that is fatal-on-error is, by default, also fatal if stopped before it completes, since the framework has no way to know whether this particular task can safely be interrupted mid-run. Override this to return false only if the task is known to tolerate being stopped at any point without leaving the extractor in an inconsistent state.

This has no effect on cancellation caused by the extractor itself shutting down (e.g. Shutdown()/DisposeAsync()) -- that is always non-fatal, regardless of this setting, since there is nothing left to protect by crashing a process that is already exiting.

Declaration
public virtual bool CancellationIsFatal { get; }
Property Value
Type Description
bool
| Edit this page View Source

ErrorIsFatal

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
| Edit this page View Source

Metadata

Provide metadata about the task, reported to integration during startup.

Declaration
public abstract TaskMetadata Metadata { get; }
Property Value
Type Description
TaskMetadata
| Edit this page View Source

Name

Unique name of the task.

Declaration
public abstract string Name { get; }
Property Value
Type Description
string
| Edit this page View Source

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
| Edit this page View Source

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 Source

CanRunNow()

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
| Edit this page View Source

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
| Edit this page View Source

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>

Extension Methods

DataModelUtils.GetOrCreateResourcesAsync<T, T2>(T2, IEnumerable<InstanceIdentifier>, Func<IEnumerable<InstanceIdentifier>, IEnumerable<SourcedNodeWrite<T>>>, Func<IEnumerable<SourcedNodeWrite<T>>, SanitationMode, (IEnumerable<SourcedNodeWrite<T>>, IEnumerable<CogniteError<SourcedNodeWrite<T>>>)>, int, int, RetryMode, SanitationMode, CancellationToken)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX