brainiak / rt-cloud

The Realtime fMRI Cloud Framework is an open-source software package that makes it easier to build and deploy real-time fMRI experiments.

Home Page:https://rt-cloud.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

timeout_file argument does not work

peetal opened this issue · comments

Hi There,

I realized that setting timeout_file to a specific number does not work. Specifically, I'm doing dicomData = dataInterface.getImageData(streamId, int(this_TR), timeout_file) for each TR, asking the code to fetch the latest DICOM file. The fileWatcher.waitForFile function says that timeout_file is the max number of seconds to watch for the file creation. However, no matter what number i set it to be, my code always expire after ~60 seconds.
Here is the fulls script: https://github.com/peetal/rt-cloud/blob/my-rt-project/projects/phantom_test/phantom_test.py

Thank you very much in advance!

Hi Grant,

I have encountered this problem with both MAC (Catalina) and LINUX (Ubuntu 20.04). I have pulled the latest version of rt-cloud, (i.e., commit 659bbfb "split environment.yml file ...".) But both the latest version and the version before have the same problem.

One thing unrelated to the current issue, after I pulled the latest version, rtcommon/openNeuro.py had problem with import boto3. So I had to do conda env update -f the_2_env_yml_file.

Thank you very much,
Peeta

Ok, I suspect what is going on is that you are hitting the RPC (Remote Procedure Call) timeout which is 60 seconds for the communication with the projectInterface.
Some info on timeouts can be found at https://github.com/brainiak/rt-cloud/blob/master/docs/how-to-wrap-your-project.md (search for timeout section).

But in short, when you instantiate the ClientInterface, try including the rpyc_timeout parameter.
On line 202 of your code try:
clientInterfaces = ClientInterface(yesToPrompts=args.yesToPrompts, rpyc_timeout=120)

There is also a function readRetryDicomFromDataInterface() in the imageHandling.py module (see usage in sample.py project). That loops watching for a file with a shorter timeout on each watchFile(), but loops multiple times which helps when waiting for the first image of a run to appear.

It perfectly solved my problem! Thank you very much!