Odoo Connectors: Connector Configuration: Job Queues and Jobs


Purpose

Jobs are serial tasks used in batch importing records of data from a source site into your Odoo database. In order to correctly map the data, you will first need to create a BackEnd for the connector site. See Connector Configuration for more details

Process

To get started, navigate to your Job Queue application.

Odoo image and text block

Managing Your Job Queue 

The following screen outlines the jobs created from the backend, and some data about their status and success. The API call will generally pull twenty records at a time, depending on the number of 'workers' enabled. Hibou will by default restrict the number of workers to one, to prevent iterative data from being imported multiple times. If the job encounters an error such as unrecognized data, it will be highlighted in red to indicate an exception. Learn more about Exceptions here.

Odoo image and text block

Our initial job created by the backend covered an order range of 1-80. The next will cover orders 81-100 and so on as the queue builds.


Odoo image and text block

The information input during the creation of your site's backend is used to structure the API call. The Task field shows us the path used to import data. For instance:

opencart.sale.order().import_batch(opencart.backend(1,),filters={'after_id': 80'})

References the Backend created during Configuration:  opencart.backend(1,)

And the Filter we applied regarding the order sequence: filters={'after_id': 80'}

Odoo image and text block

Note at the bottom of this section, there is information about the number of retries and how they are limited. Limiting retries allows the job to attempt completion before flagging it as failed. Limiting the number provides a useful stopping point, allowing you to see where the error occurred and halting the flow of orders until it is addressed. 

Odoo image and text block

If the Job failed because the data didn't meet the specified criteria, the Job will highlight in red in the list view, and a field titled Exception Information will appear. The status of the job will jump from 'Started' to 'Failed'.  The job can be requeued once the exception is cleared. Exceptions are customizable to an extent, and Hibou can assist in their development to make sure the important information is transferred correctly!

Learn more about Exceptions and their causes here.

Odoo image and text block
Odoo image and text block

Queueing Jobs

Sometimes jobs fail for good reason. Incomplete or missing shipping data, mismatched payment method addresses, and unrecognized products are all potential suspects.

It is easy to restart a job by selecting the Requeue Job button at the top of the screen. This will move the job to the Enqueued state.

Odoo image and text block

The job should only take a minute or two to complete once queued. In the event that a job failed for a known reason, and it doesn't make sense to import the order, setting the job to done will halt any further attempts at import. Use the Set to 'Done' button at the top of screen. The job will remain in the queue list until archived or addressed externally.