While searching the StackExchange for 'Queued' I found that most answers are related to apex code. In my case I'm using the SalesforceBulk API (through python).

My scenario: When calling the batch_status(job_id, batch_id) method, in most cases I'm getting 'State': 'Completed', but from time to time I'm getting State': 'Queued'.

How to relate to state? I couldn't understand from the documentation if those jobs will get out of the queue automatically and I just need to check the status from time to time, or should I trigger something to get them out of the queue and to be processed.

  • What Python library are you using? Some have nice convenience methods to abstract away polling state for you. – David Reed Jun 19 at 16:28
  • I'm using salesforce-bulk 2.1.0 – Gil Jun 20 at 6:12

Its a Job Queue, The queue will process when the system has available resource. The only thing you can do is Abort after a job is queued. You cannot trigger it asap, force it run now or prioritize it.

Have a look at this doc that will help you interpret what batch state mean.

  • So if "The queue will process when the system has available resource." isn't it better to wait and check for state till it will be completed, instead of Abort and retry? – Gil Jun 20 at 6:51
  • @Gil I have rephrased my statement to give clear context. Yes you have to wait till it get exxecuetd. – Pranay Jaiswal Jun 20 at 6:55
  • Thanks @Pranay, I will run batch_status() from time to time till state will turn Completed or Failed – Gil Jun 20 at 7:03

You can't control the platform's timing in terms of processing Bulk API batches, and there's no action you need to take to move them into processing once you've finished uploading the batch.

salesforce_bulk has a convenience method so that you don't have to poll or inspect the batch status yourself. Just do


The last two parameters are optional. salesforce_bulk will poll and sleep for you until the batch completes (either successfully or not). You can then call bulk.get_batch_results(batch_id, job_id) to get back the successes or failures.

  • Thanks @David, sounds like a good idea – Gil Jun 23 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.