Retrieving BatchJob by ID returns no BatchJobPage entries

64 views
Skip to first unread message

goingdev

unread,
Apr 15, 2016, 1:31:41 PM4/15/16
to AdWords API Forum
I'm getting 0 entries returned when using the BatchJobService to retrieve a job by its ID. My code:

                Selector selector = new Selector()
                {
                    fields = new string[] 
                    { 
                        BatchJob.Fields.Id, BatchJob.Fields.Status,
                        BatchJob.Fields.DownloadUrl, BatchJob.Fields.ProcessingErrors,
                        BatchJob.Fields.ProgressStats 
                    },
                    predicates = new Predicate[] {
                    Predicate.Equals(BatchJob.Fields.Id, jobID)
                    }
                };
                BatchJobService batchJobService = (BatchJobService)user.GetService(AdWordsService.v201601.BatchJobService);
                var batchJobPage = batchJobService.get(selector);

batchJobPage gives 0 entries. How can  I troubleshoot this?

Yin Niu

unread,
Apr 15, 2016, 3:30:59 PM4/15/16
to AdWords API Forum
Hi, 

Do you have the SOAP request and response logs for this job? Pleaase click Reply privately to author in the forum when responding. 

Thanks,
Yin, AdWords API Team. 

goingdev

unread,
Apr 18, 2016, 4:28:56 PM4/18/16
to AdWords API Forum
I'm getting this for a few job IDs

Request:
<?xml version="1.0" encoding="utf-8"?>
  <soap:Header>
      <developerToken xmlns="https://adwords.google.com/api/adwords/cm/v201601">x</developerToken>
      <clientCustomerId xmlns="https://adwords.google.com/api/adwords/cm/v201601">x</clientCustomerId>
      <userAgent xmlns="https://adwords.google.com/api/adwords/cm/v201601">x</userAgent>
    </RequestHeader>
  </soap:Header>
  <soap:Body>
      <selector>
        <fields>Id</fields>
        <fields>Status</fields>
        <fields>DownloadUrl</fields>
        <fields>ProcessingErrors</fields>
        <fields>ProgressStats</fields>
        <predicates>
          <field>Id</field>
          <operator>EQUALS</operator>
          <values>86004965</values>
        </predicates>
      </selector>
    </get>
  </soap:Body>
</soap:Envelope>

Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
      <requestId>000530c82fda85e00ac13c16640092ee</requestId>
      <serviceName>BatchJobService</serviceName>
      <methodName>get</methodName>
      <operations>1</operations>
      <responseTime>424</responseTime>
    </ResponseHeader>
  </soap:Header>
  <soap:Body>
      <rval>
        <totalNumEntries>0</totalNumEntries>
        <Page.Type>BatchJobPage</Page.Type>
      </rval>
    </getResponse>
  </soap:Body>
</soap:Envelope>

goingdev

unread,
Apr 19, 2016, 11:39:01 AM4/19/16
to AdWords API Forum
How do I troubleshoot this?   I'm trying to migrate to BatchJobService but cannot do so if I cannot retrieve job results reliably.

Nadine Sundquist (AdWords API Team)

unread,
Apr 19, 2016, 12:04:17 PM4/19/16
to AdWords API Forum
Hello,

It sounds like you're working your way through our Batch Processing guide for your migration. I have a few questions to ask to help you troubleshoot:
  • Are you using the batch job utility provided by the client library to upload your operations?
  • Have you tried calling just BatchJobSerice.get() without predicates to see if your job appears?
  • How are you getting the batch job ID? Are you getting it from the BatchJob.id field?
Regards,
Nadine, AdWords API Team

goingdev

unread,
Apr 19, 2016, 1:16:58 PM4/19/16
to AdWords API Forum
Thank you for that... I tried excluding the predicates and I didn't get any results. I realized I wasn't passing in the correct client customer ID. I'm able to retrieve the job now.

I'm having another issue now with downloading the results. It's giving an "out of memory exception" on this line:

BatchJobMutateResponse mutateResponse = batchJobUploadHelper.Download(batchJob.downloadUrl.url);

Does the API not handle large jobs? Should I be batching them like I have been the MutateJobService?

Nadine Sundquist (AdWords API Team)

unread,
Apr 19, 2016, 2:02:44 PM4/19/16
to AdWords API Forum
Greetings!

It's good to hear that you're now getting results back. As for the results running out of memory, the utility just retrieves the entire result from the URL. It isn't streamed or broken down into smaller chunks. If you find the result is too large, you have a couple of options:
  • Increase the amount of memory on your system that your process is allowed to use.
  • Decrease the number of operations per batch job, since you wouldn't be able to handle the size of the results.
For the future, you could also file an issue on GitHub to add the feature of streaming results. 

Cheers,
Nadine, AdWords API Team

goingdev

unread,
Apr 19, 2016, 3:12:42 PM4/19/16
to AdWords API Forum
Thank you for your help.
Reply all
Reply to author
Forward
0 new messages