public function TripalImporter::submitJob
3.x TripalImporter.inc | public TripalImporter::submitJob() |
Submits the importer for execution as a job.
Return value
The ID of the newly submitted job.
File
- tripal/
includes/ TripalImporter.inc, line 386
Class
Code
public function submitJob() {
global $user;
$class = get_called_class();
if (!$this->import_id) {
throw new Exception('Cannot submit an importer job without an import record. Please run create() first.');
}
// Add a job to run the importer.
try {
$args = array($this->import_id);
$includes = array(
module_load_include('inc', 'tripal', 'api/tripal.importer.api'),
);
$job_id = tripal_add_job($class::$button_text, 'tripal',
'tripal_run_importer', $args, $user->uid, 10, $includes);
return $job_id;
}
catch (Exception $e) {
throw new Exception('Cannot create importer job: ' . $e->getMessage());
}
}