parfeval with fetch not working

5 visualizzazioni (ultimi 30 giorni)
Hello guys. When I call the fetch() function with parfeval, I get the following error:
parfeval(@fetch,1,database,query)
Error: 'Dot indexing is not supported for variables of this type.'
On the other hand, without parfeval, the function works perfectly. What could it be?

Risposta accettata

Edric Ellis
Edric Ellis il 13 Lug 2022
You cannot pass database connection objects to workers directly like this. You should use createConnectionForPool . There are examples on that doc page that show you how to set up and use this. You'll end up with something like this:
c = createConnectionForPool(..);
% Wrap the call to "fetch" to unpick the .Value out of the pool connection
% object 'c'.
fut = parfeval(@(c, varargin) fetch(c.Value, varargin{:}), 1, c, query)
  1 Commento
HILTON MARQUES SANTANA
HILTON MARQUES SANTANA il 14 Lug 2022
Modificato: HILTON MARQUES SANTANA il 14 Lug 2022
Thanks! It's working. Just another question. I am trying to speed up some queries on a online database on this way:
f = parfeval(@(c, varargin) fetch(c.Value, varargin{:}), 1, c, query1);
f(end+1) = parfeval(@(c, varargin) fetch(c.Value, varargin{:}), 1, c, query2);
f(end+1) = parfeval(@(c, varargin) fetch(c.Value, varargin{:}), 1, c, query3);
res1 = fetchOutputs(f(1));
res2 = fetchOutputs(f(3));
res3 = fetchOutputs(f(2));
But the time is not decreasing too much. There is a more efficient approach?
Thanks in advance

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Background Processing in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by