Class Job
Represents a background job with parameters, progress, and a status
Inherited Members
Namespace: DataWeb.Worker
Assembly: DataWeb.Core.dll
Syntax
public class Job
Remarks
Creates a new instance of the Job class
Constructors
Job(IJobStore)
Represents a background job with parameters, progress, and a status
Declaration
public Job(IJobStore jobStore)
Parameters
Type | Name | Description |
---|---|---|
IJobStore | jobStore | The job store to use for database access |
Remarks
Creates a new instance of the Job class
Properties
DateEnd
Gets or sets the end date of the job
Declaration
public DateTimeOffset? DateEnd { get; set; }
Property Value
Type | Description |
---|---|
DateTimeOffset? |
DateStart
Gets or sets the start date of the job
Declaration
public DateTimeOffset DateStart { get; set; }
Property Value
Type | Description |
---|---|
DateTimeOffset |
Errors
Gets or sets the error count for the job
Declaration
public int Errors { get; set; }
Property Value
Type | Description |
---|---|
int |
Id
Gets or sets the unique identifier.
Declaration
public string Id { get; set; }
Property Value
Type | Description |
---|---|
string |
Name
Gets or sets the name of the job
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Parameters
Gets or sets the collection of parameters for the job
Declaration
public List<Parameter> Parameters { get; set; }
Property Value
Type | Description |
---|---|
List<Parameter> |
Progress
Gets or sets the progress count for the job
Declaration
public int Progress { get; set; }
Property Value
Type | Description |
---|---|
int |
RawParameters
Gets or sets the raw string representation of the job parameters
Declaration
public string RawParameters { get; set; }
Property Value
Type | Description |
---|---|
string |
Status
Gets or sets the current status of the job
Declaration
public JobStatus Status { get; set; }
Property Value
Type | Description |
---|---|
JobStatus |
Total
Gets or sets the total number of units of work for the job
Declaration
public int Total { get; set; }
Property Value
Type | Description |
---|---|
int |
Methods
AppendErrorAsync(string, CancellationToken)
Appends an error message to the text log of the job
Declaration
public Task AppendErrorAsync(string message, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | message | The error message to append to the text log |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | An asynchronous operation that appends the error message to the job text log |
AppendLogAsync(string, string, CancellationToken)
Appends a log message to the text log of the job
Declaration
public Task AppendLogAsync(string status, string message, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | status | The status of the log message |
string | message | The message to append to the text log |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | An asynchronous operation that appends the log message to the job text log |
CompleteAsync(CancellationToken)
Completes the job by setting its status to Completed in the job store
Declaration
public Task CompleteAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | An asynchronous operation that sets the job status to Completed in the job store |
UpdateAsync(CancellationToken)
Updates the entry for the job in the job store
Declaration
public Task UpdateAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | An asynchronous operation that updates the job entry in the job store |