[Bioc-devel] Something about time out errors

Dan Tenenbaum dtenenba at fredhutch.org
Mon Mar 27 23:35:17 CEST 2017



----- Original Message -----
> From: "Martin Morgan" <martin.morgan at roswellpark.org>
> To: "Rainer Johannes" <Johannes.Rainer at eurac.edu>
> Cc: "Aimin Yan" <aimin.at.work at gmail.com>, "bioc-devel" <bioc-devel at r-project.org>
> Sent: Monday, March 27, 2017 12:29:49 PM
> Subject: Re: [Bioc-devel] Something about time out errors

> On 03/27/2017 12:57 PM, Rainer Johannes wrote:
>> Do you have code fetching data from web resources? I also sometimes get timeout
>> errors on ensembldb and I guess it's because in some unit tests I'm fetching
>> data from the ensembl ftp server.
>>
>
> Testing web resources is a pretty interesting topic. It doesn't really
> make sense to spend a lot of time downloading a large amount of data,
> but rather to focus the test on the existence of the endpoint, and the
> returned data type. It seems like these tests can be fast and
> light-weight. One approach (for static resources) might ask the web
> server for a last-modified or entity tag (ETag) value, and compare that
> to a manually maintained last-known-good exemplar.
>
> Unit tests for parsing the data into R and processing the data once in R
> are really separate from the web resource, and should probably be
> isolated from tests of the web resource itself.
>
> The approach on this page
>
>   http://bioconductor.org/developers/how-to/web-query/
>
> especially use of timeout(), might be a reasonable way to implement
> this; also BiocFileCache is now available and provides appropriate
> functionality (although looking I see that it doesn't currently support
> time-outs -- but it's better to fix this in the one location rather than
> in many different locations).
>

Another approach is to write a function that simply returns the web resource, and then 'mock' that function in your unit tests, to have it return an expected result. This keeps the scope of your unit tests appropriate (i.e. you are only testing your own code, you're not testing if some resource is available on a remote server or if the internet is working that day). 

Look at ?with_mock in the `testthat` package for more information. 

Dan



> Martin
>
>> jo
>>
>>> On 27 Mar 2017, at 18:37, Martin Morgan <Martin.Morgan at RoswellPark.org> wrote:
>>>
>>> On 03/27/2017 12:22 PM, Aimin Yan wrote:
>>>> I am submitting a R package to bioconductor. but I got time out errors when
>>>> I performed R CMD check.
>>>>
>>>>
>>>> Is there a possible way that I can set up time to allow more time for R CMD
>>>> check? Or I have to use examples that they do not cost large time.
>>>
>>> Submitted packages need to conform to package guidelines for space and time
>>>
>>>  http://bioconductor.org/developers/package-guidelines/#correctness
>>>
>>> so you'll need to develop realistic examples requiring modest resources.
>>>
>>> Often long-running examples result from inefficient code, so it is worth-while
>>> to profile your code to discover where the most time is spent, and seek
>>> efficient implementations for that section of code either through better use of
>>> vectorization or more sophisticated algorithms.
>>>
>>> Martin
>>>
>>>>
>>>>
>>>> Thank you for your help
>>>>
>>>> Aimin
>>>>
>>>> 	[[alternative HTML version deleted]]
>>>>
>>>> _______________________________________________
>>>> Bioc-devel at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>>>
>>>
>>>
>>> This email message may contain legally privileged and/or...{{dropped:2}}
>>>
>>> _______________________________________________
>>> Bioc-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>
>
>
> This email message may contain legally privileged and/or...{{dropped:2}}
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel



More information about the Bioc-devel mailing list