I am new to SKILL, so this may be an easy question for someone to answer:
I am working on a custom SKILL interface that is made up of a Tree Table. In order to generate the report, I have to expand all of the items in the tree. When I expand the tree items, there is a callback that generates an asynchronous method to get information from a command line script that updates information in the tree, and then updates the GUI with the information through another callback. This asynchronous update is performed for each item in the tree. For large trees, this expanding and updating could take 10-20 minutes.
In order to generate my report, I need to expand all of the items in the tree, and then wait for the asynchronous update to complete before I can generate my report to export.
I see that I have 3 options:
1. Figure out a way to execute a callback function when all of the updates are done (is this possible?)2. for the report output, implement a synchronous update as each item is expanded, and wait for each item to be updated, and when the last update is updated generate the report3. Poll the asynchronous process, or the data, with an hiSleep() , until the last process is complete, all the fields for each Tree item is populated, or a global variable that would track each item's status, and then run the report
I have implemented #3, and it works, but it does not seem to be the most appropriate solution, so I am looking for suggestions.
You should look at the ipc commands (inter process communication). You can start scripts and wait for their results and do things when they finish.
Another way I have updated a form by using hiRegTimer. This command will setup a Skill command to run in the future. It takes a string and an integer value representing tenths of seconds.
This would run your "checkMyProcess" command 60 seconds from now. If things are not done yet, it can update the form and then submit another hiRegTimer. Do this until it is done. The difference between this and hiSleep is that you can still use your Cadence session.
Thanks for the quick reply. I have looked at the IPC commands, but because the expansion of the tree launches numerous individual processes, one process for each tree expansion entry, I cannot simply monitor one process. I would need to know when the last tree entry is processed, and then monitor that one.
Does that make sense?
Not only can you check to see if ipc processes are still alive and running (ipcIsAliveProcess), but you can also communicate back to Cadence from the script started by ipcBeginProcess. Each process could tell your Cadence session when it is done. Thus, your tree should be ready once all sub-processes have communicated back to the Cadence session that they have completed.
ipcId = ipcBeginProcess(cmd "" 'myIpcDataHandler 'myIpcErrHandler 'myIpcFinishHandler "/tmp/ipc.log")
procedure(myIpcDataHandler(ipcId data) let((result) printf("in myIpcDataHandler with %L\n" data) ;If the script creates Skill code, the following would run it in your Cadence session foreach(d parseString(data "\n") unless(errset(result=evalstring(d)) printf("%L" errset.errset) ) ; unless ) ))NOTE: I edited the original post of this message since the Skill syntax was incorrect. There was a missing printf in the middle of the unless section.