View Full Version : Call Lianja.execute() from a spawned python call

2018-05-18, 10:00
Hi Barry,

I am using the new Lianjarun command - which is working great.


Since I am spawning many simultaneous threads, I am trying to have those threads update a table when they are completed.

In my python call, I import Lianja a the top, and at the end of the function I am trying to call a vfp function called dispatchminus() like so.


As I suspeccted might occur, I get a console message dispatchminus.dbo does not exist.

Is there a way I can specify in a spawned call where I would like a function to run from?



2018-05-18, 10:26
Thinking about this some more, I probably want to have a proc in the database itself or possibly just do an openrecordset from python.

2018-05-18, 17:49
Hi Herb,

if your calls are all being made in the same place, an easy way to know when all are done is a) get the spawnpid() of each task, adding them to an array, b) after all the tasks are dispatched iterate the array, testing for activepid(), and when none of them are active, move on.

If they are being called in different places (however defined), you can use sessionStorage for the pids, and access/test from the common ending point.

If you have the possibility of multiple servers servicing one "run" of these processes (e.g., microservice calls that load balance), a data-oriented approach where each process registers in the ProcessState table under a master "this is all the same job" ID and then each process also changes its own "lDone" flag to .T. when done is a nice option. In this situation I also typically include tStarted, tHeartbeat, and mErrorInfo, in the hopes of determining the source of any hangs while also knowing when to knock out the main call based on an "it can't be longer than this or we're dead in the water" value set in a convenient place.


2018-05-18, 20:58
Hi Herb,

You can try specifying —path

You should also be aware that if you are doing this while developing the database and table may be opened exclusively in the app builder so attempting to update it and share data during development may result in some unexpected behavior.