Open kunal4422 opened 4 years ago
I added an example to the README which shows how to use PK Chunking. Let me know if that helps you. https://github.com/heroku/salesforce-bulk/pull/77/files
I actually think this is a bug. is_batch_done
throws an error when the return status is NOT_PROCESSED
. But according to salesforce doc, NOT_PROCESSED
is expected while chunking.
hdao1121, do you know if this ever got resolved?
If you are at the point of using pk_chunking, you are better off not using is_batch_done and instead getting the batch status list to determine completion. The example in the linked PR is on path do that.
Here is the associated code :
` job_id = bulk.create_queryall_job("Contact", contentType='CSV',pk_chunking=100000,concurrency='Serial') batch_id = bulk.query(job_id, "select twitter_profilec, useridc from contact") batch_list=bulk.get_batch_list(job_id) for item in batch_list:batch_id=item['id'],job_id=item['jobId'] while not bulk.is_batch_done(batch_id=batch_id,job_id=job_id):
print(item)
Output :
[{'id': '75118000004I1CtAAK', 'jobId': '75018000004sUucAAE', 'state': 'NotProcessed', 'createdDate': '2019-12-26T08:47:36.000Z', 'systemModstamp': '2019-12-26T08:47:37.000Z', 'numberRecordsProcessed': '0', 'numberRecordsFailed': '0', 'totalProcessingTime': '0', 'apiActiveProcessingTime': '0', 'apexProcessingTime': '0'}, {'id': '75118000004I1CyAAK', 'jobId': '75018000004sUucAAE', 'state': 'Queued', 'createdDate': '2019-12-26T08:47:37.000Z', 'systemModstamp': '2019-12-26T08:47:37.000Z', 'numberRecordsProcessed': '0', 'numberRecordsFailed': '0', 'totalProcessingTime': '0', 'apiActiveProcessingTime': '0', 'apexProcessingTime': '0'}, {'id': '75118000004I1D3AAK', 'jobId': '75018000004sUucAAE', 'state': 'Queued', 'createdDate': '2019-12-26T08:47:37.000Z', 'systemModstamp': '2019-12-26T08:47:37.000Z', 'numberRecordsProcessed': '0', 'numberRecordsFailed': '0', 'totalProcessingTime': '0', 'apiActiveProcessingTime': '0', 'apexProcessingTime': '0'}, {'id': '75118000004I1D8AAK', 'jobId': '75018000004sUucAAE', 'state': 'InProgress', 'createdDate': '2019-12-26T08:47:37.000Z', 'systemModstamp': '2019-12-26T08:47:37.000Z', 'numberRecordsProcessed': '0', 'numberRecordsFailed': '0', 'totalProcessingTime': '0', 'apiActiveProcessingTime': '0', 'apexProcessingTime': '0'}, {'id': '75118000004I1D9AAK', 'jobId': '75018000004sUucAAE', 'state': 'Queued', 'createdDate': '2019-12-26T08:47:37.000Z', 'systemModstamp': '2019-12-26T08:47:37.000Z', 'numberRecordsProcessed': '0', 'numberRecordsFailed': '0', 'totalProcessingTime': '0', 'apiActiveProcessingTime': '0', 'apexProcessingTime': '0'}, {'id': '75118000004I1DDAA0', 'jobId': '75018000004sUucAAE', 'state': 'Queued', 'createdDate': '2019-12-26T08:47:37.000Z', 'systemModstamp': '2019-12-26T08:47:37.000Z', 'numberRecordsProcessed': '0', 'numberRecordsFailed': '0', 'totalProcessingTime': '0', 'apiActiveProcessingTime': '0', 'apexProcessingTime': '0'}, {'id': '75118000004I1DIAA0', 'jobId': '75018000004sUucAAE', 'state': 'Queued', 'createdDate': '2019-12-26T08:47:37.000Z', 'systemModstamp': '2019-12-26T08:47:37.000Z', 'numberRecordsProcessed': '0', 'numberRecordsFailed': '0', 'totalProcessingTime': '0', 'apiActiveProcessingTime': '0', 'apexProcessingTime': '0'}] 75118000004I1CtAAK 75018000004sUucAAEBulkBatchFailed Traceback (most recent call last)