def do_real_import(self, vsfile, filepath,mdXML,import_tags):
"""
Make the import call to vidispine, and wait for self._importer_timeout seconds for the job to complete.
Raises a VSException representing the job error if the import job fails, or ImportStalled if the timeout occurs
:param vsfile: VSFile object to import
:param filepath: filepath of the VSFile
:param mdXML: compiled metadata XML to import alongside the media
:param import_tags: shape tags describing required transcodes
:return: None
"""
import_job = vsfile.importToItem(mdXML, tags=import_tags, priority="LOW", jobMetadata={"gnm_app": "vsingester"})
job_start_time = time.time()
close_sent = False
while import_job.finished() is False:
self.logger.info("\tJob status is %s" % import_job.status())
if time.time() - job_start_time > self._importer_timeout:
self.logger.error("\tJob has taken more than {0} seconds to complete, concluding that it must be stalled.".format(self._importer_timeout))
import_job.abort()
self.logger.error("\tSent abort signal to job")
raise ImportStalled(filepath)
if time.time() - job_start_time > self._close_file_timeout and not close_sent:
vsfile.setState("CLOSED")
sleep(5)
import_job.update(noraise=False)
评论列表
文章目录