ARTIFACTORY: How to monitor the system import and export processes

Anand Das
2022-06-06 08:56

When a user triggers a system import or export as described here, what they will end up seeing in their browser is a loading circle. Should they remain on that page, the loading circle will remain until the job is complete, in which case a notification will appear in the UI indicating that the job is completed successfully.

User-added image

User-added image

However, should the user exit out of the page, the job will continue to run in the background while the loading circle will disappear. The user will even be able to navigate back to the import/export page and trigger a new job.

For users who are performing large imports or exports, it is often not feasible to leave the page open, or it might be easy to navigate away from the page or accidentally close out of it. Thus, we need a way to be able to monitor the import/export job to ensure that it is actually running and when it has completed.

This can be achieved by using the background tasks REST API call, which requires an admin user.
curl -u admin:<password> http:/<Artifactory URL>/artifactory/api/tasks -o tasks.json

The REST API call above gets the full list of running background tasks as a list of JSON objects and saves it to a file.

Once you have this tasks.json file on hand, you can open it in a text editor and search for either “Import” or “Export”, depending on the job you are running. If the job is still running, you will encounter a JSON object that appears similar to the below.
{
    "id" : "artifactory.ExportJob#ae103c87-53f2-485c-b56f-0a580caafe1e",
    "type" : "org.artifactory.repo.service.ExportJob",
    "state" : "running",
    "description" : "Export Repository - FULL (manual trigger)",
    "started" : "2022-05-31T19:03:35.718Z"
  }

If all import and export jobs are complete, you will not find any results in the search.

To double check that your system import or export is complete, look for the following lines, which differ based on the job, in your artifactory-service.log.

Export:

2022-05-31T19:05:29.982Z [jfrt ] [INFO ] [1f4ae676b5564ab7] [ifactoryApplicationContext:876] [http-nio-8081-exec-6] - Full system export completed successfully.

Import:

2022-05-31T19:07:42.545Z [jfrt ] [INFO ] [4e30cef0c380b07b] [ifactoryApplicationContext:726] [http-nio-8081-exec-5] - ### Full system import finished ###

If, after performing one of these tasks, you encounter inconsistencies with the data imported or exported, check the artifactory-service logs for errors, look through our knowledge base for articles on any errors encountered, and, if need be, reach out to JFrog Support.