Skip to content

Job

Jobs - a way to run long-running tasks in the background. Jobs are used to run tasks that take a long time to complete, such as syncing data between Crowdin and a third-party service.

Currently, it can be used in the updateCrowdin and updateCrowdin functions of the Project Integration app.

The Job object has the following properties:

  • type - the type of the job (cron, manual, rerun).

Functions

update

Function to update the job status. It accepts an object with the following fields:

  • progress - the progress of the job (0-100).
  • status - the status of the job (in_progress, finished, failed, canceled).
  • info - additional information about the job.
  • data - additional data about the job.

fetchTranslation

Function to fetch a translation for a specific file and language. It accepts an object with the following fields:

  • fileId - the ID of the file.
  • languageId - the ID of the language.

translationUploaded

Use this function to notify Crowdin that a translation has been uploaded. It accepts an object with the following fields:

  • fileId - the ID of the file.
  • translationParams - an array of objects with the following fields:
    • languageId - the ID of the language.
    • etag - the etag of the translation.

Persistence

By default job executor preserves information about files in database but for large projects with large number of languages and files this could be a bottleneck.
As an alternative, job executor could be configured to store this in memory. But as a consequence it will lose this during redeploys and drawback of this is extra requests for translations.
To activate in memory store, provide jobStoreType for the projectIntegration setup.

projectIntegration.jobStoreType = 'in-memory';

Read more in the Upload Only New Translations section.

markFilesAsUnsynced

Function to mark files as unsynced. It accepts an object with the following field:

  • fileIds - An array of file IDs that should be marked as unsynced.

Read more in the Unsynced Files section.