|
| 1 | +The function ``parpopulate`` works identically to ``populate`` except that it uses a job reservation mechanism to allow multiple processes to populate the same table in parallel without collision. |
| 2 | +When running ``parpopulate`` for the first time, DataJoint will create a job reservation table and its class ``<package>.Jobs`` with the following declaration: |
| 3 | + |
| 4 | +.. code-block:: matlab |
| 5 | +
|
| 6 | + {% |
| 7 | + # the job reservation table |
| 8 | + table_name : varchar(255) # className of the table |
| 9 | + key_hash : char(32) # key hash |
| 10 | + --- |
| 11 | + status : enum('reserved','error','ignore')# if tuple is missing, the job is available |
| 12 | + key=null : blob # structure containing the key |
| 13 | + error_message="" : varchar(1023) # error message returned if failed |
| 14 | + error_stack=null : blob # error stack if failed |
| 15 | + host="" : varchar(255) # system hostname |
| 16 | + pid=0 : int unsigned # system process id |
| 17 | + timestamp=CURRENT_TIMESTAMP : timestamp # automatic timestamp |
| 18 | + %} |
| 19 | +
|
| 20 | +A job is considered to be available when ``<package>.Jobs`` contains no matching entry. |
| 21 | + |
| 22 | +For each ``make`` call, ``parpopulate`` sets the job status to ``reserved``. |
| 23 | +When the job is completed, the record is removed. |
| 24 | +If the job results in error, the job record is left in place with the status set to ``error`` and the error message and error stacks saved. |
| 25 | +Consequently, jobs that ended in error during the last execution will not be attempted again until you delete the corresponding entities from ``<package>.Jobs``. |
| 26 | + |
| 27 | +The primary key of the jobs table comprises the name of the class and a 32-character hash of the job's primary key. |
| 28 | +However, the key is saved in a separate field for error debugging purposes. |
0 commit comments