(self, domain, config, comment=None)
Save a CaseUploadRecord and trigger a task that runs the upload

        The task triggered by this must call case_upload.wait_for_case_upload_record() before using it
        to avoid a race condition.
Save a CaseUploadRecord and trigger a task that runs the upload
Save a CaseUploadRecord and trigger a task that runs the upload
def trigger_upload(self, domain, config, comment=None):
        """
        Save a CaseUploadRecord and trigger a task that runs the upload

        The task triggered by this must call case_upload.wait_for_case_upload_record() before using it
        to avoid a race condition.
        """
        from corehq.apps.case_importer.tasks import bulk_import_async
        original_filename = transient_file_store.get_filename(self.upload_id)
        with open(self.get_tempfile(), 'rb') as f:
            case_upload_file_meta = persistent_file_store.write_file(f, original_filename, domain)

        task = bulk_import_async.delay(config.to_json(), domain, self.upload_id)
        CaseUploadRecord(
            domain=domain,
            comment=comment,
            upload_id=self.upload_id,
            task_id=task.task_id,
            couch_user_id=config.couch_user_id,
            case_type=config.case_type,
            upload_file_meta=case_upload_file_meta,
        ).save()
def trigger_upload ( self , domain , config , comment = None ) : from corehq . apps . case_importer . tasks import bulk_import_async original_filename = transient_file_store . get_filename ( self . upload_id ) with open ( self . get_tempfile ( ) , 'rb' ) as f : case_upload_file_meta = persistent_file_store . write_file ( f , original_filename , domain ) task = bulk_import_async . delay ( config . to_json ( ) , domain , self . upload_id ) CaseUploadRecord ( domain = domain , comment = comment , upload_id = self . upload_id , task_id = task . task_id , couch_user_id = config . couch_user_id , case_type = config . case_type , upload_file_meta = case_upload_file_meta , ) . save ( )