Job

Job

Job describes a series of related actions for DART to perform. This typically includes packaging a number of files and sending them across a network to one or more remote repositories, though it does not have to include those actions. A job may consist of a single action, such as validating a bag or uploading a file to an S3 bucket.

Constructor

new Job()

Parameters:
Name Type Description
opts.id string

A UUID in hex-string format. This is the object's unique identifier.

opts.userCanDelete boolean

Indicates whether user is allowed to delete this record.

opts.bagItProfile BagItProfile

A BagItProfile object. This is required only for bagging and validation jobs.

opts.packageOp PackageOperation

An object describing what this job is supposed to package. The is relevant only to jobs that involving bagging or other forms of packaging.

opts.validationOp ValidationOperation

An object describing what is to be validated. This is relevant only if the job includes a validation step.

opts.uploadOps Array.<UploadOperation>

A list of objects describing what should be uploaded, and to where. This is relevant only for jobs that will be uploading materials.

Source:

Members

byteCount :number

The total number of bytes in the payload to be packaged and/or uploaded by this job. This number may not match to total size of the bag the job produces because the bag may include additiaonal manifests and tag files, and it may be serialized to a format like tar that makes it slightly larger, or to a format like zip or gzip that makes it smaller.

This value is set when building a Job through the DART UI, but it may not be set by the command-line tools. If DART does not set this value, it remains at the default of -1.

Default Value:
  • -1
Source:

dirCount :number

The total number of directories to be packaged and/or uploaded by this job. This value is set when building a Job through the DART UI, but it may not be set by the command-line tools. If DART does not set this value, it remains at the default of -1.

Default Value:
  • -1
Source:

errors

This hash will contain descriptions of job validation errors after you call job.validate(). This does NOT contain information about errors that occurred while running the job. For those, see the result propertype (type OperationResult) of the job's PackageOperation, ValidationOperation, or UploadOperation.

Source:

fileCount :number

The total number of files to be packaged and/or uploaded by this job. This value is set when building a Job through the DART UI, but it may not be set by the command-line tools. If DART does not set this value, it remains at the default of -1.

Default Value:
  • -1
Source:

title

This returns a title for display purposes. It will use the first available non-empty value of: 1) the name of the file that the job packaged, 2) the name of the file that the job uploaded, or 3) a title or description of the bag from within the bag's tag files. If none of those is available, this will return "Job of ", where timestamp is date and time the job was created.

Source:

workflowId :string

The id of the workflow from which this job was created. If the job was not created from a Workflow, this will be null.

This attribute is significant only to some portions of the UI, which may hide some job configution options since the workflow already describes what those options should be.

For info on how a Workflow becomes a Job, see JobParams#toJob.

Source:

Methods

(static) find(id) → {Job}

find finds the Job with the specified id in the datastore and returns it. Returns undefined if the object is not in the datastore.

This overrides the find() method of the PersistentObject to return a correctly constructed Job object.

Parameters:
Name Type Description
id string

The id (UUID) of the job you want to find.

Source:

(static) genericName(date) → {string}

This returns a generic job name that includes a date and time.

Parameters:
Name Type Description
date Date

The date the job was created. Use job.createdAt.

Source:

(static) inflateFrom(data) → {Job}

This converts the JSON representation of a job as stored in the DB to a full-fledged Job object with all of the expected methods.

Parameters:
Name Type Description
data Object

A JavaScript hash.

Source:

(static) inflateFromFile(pathToFile) → {Job}

This converts the JSON data in the file at pathToFile into a Job object.

Parameters:
Name Type Description
pathToFile string

The path to the JSON file.

Source:

getRunErrors() → {Array.<string>}

Returns a list of errors from all of this job's operations.

Source:

isRunning() → {boolean}

Returns true if this job is currently running.

Source:

packageAttempted() → {boolean}

Returns true if DART attempted to execute this job's package operation.

Source:

packagedAt() → {Date}

Returns the datetime on which this job's package operation completed.

Source:

packageSucceeded() → {boolean}

Returns true if DART successfully completed this job's package operation. Note that this will return false if packaging failed and if packaging was never attempted, so check packageAttempted as well.

Source:

uploadAttempted() → {boolean}

Returns true if DART attempted to execute any of this job's upload operations.

Source:

uploadedAt() → {Date}

Returns the datetime on which this job's last upload operation completed.

Source:

uploadSucceeded() → {boolean}

Returns true if DART successfully completed all of this job's upload operations. See uploadAttempted as well.

Source:

validate() → {boolean}

validate returns true or false, indicating whether this object contains complete and valid data. If it returns false, check the errors property for specific errors.

Source:

validatedAt() → {Date}

Returns the datetime on which this job's validation operation completed.

Source:

validationAttempted() → {boolean}

Returns true if DART attempted to execute this job's validation operation.

Source:

validationSucceeded() → {boolean}

Returns true if DART successfully completed this job's validation operation. See validationAttempted as well.

Source: