Running script in parallel

I created server event with processing data (reading data from CSV file) and I would like to run this script parallelly for processing more files in one time.
What’s the best way to do this ?

When a server event created, it can be run as an instance by OPENEVENT action.
Important thing is, the script itself must have a parent (EVH process) which may not be running. So you configure e.g. NonRunning.EVH and move all your server events that are to be run in parallel, into this EVH (via export/import). And then you run them via OPENEVENT action (one of parameters is the name of EVH where the specific instance should run).
And that’s it. After creating the instance you can use standard RPC calls e.g. to tell this instance what to do - via CALL action.
A fragment from my script (which opens instance _i of event E._SysProf.Backup.Executor and then calls its RPC procedure StartBackup:

OPENEVENT E._SysProf.Backup.Executor DIRECT INSTANCE _i SYNC
SV._SysProf.Backup.Tasks[_i]^Running := @TRUE
WAIT
CALL [E._SysProf.Backup.Executor] StartBackup(_i, _timeout, _hobj, _row) ASYNC ON _thisEvh INSTANCE _i

Thanks you for your useful information. I tried it and it works! I have one more question due to new parent - I created new script with parent NonRunning.EVH and I deleted old one. I was not able to change process on existing script. Is there any way to change process (*.EVH) on existing script ?

There are actually 2 ways.
The first one is XML export of respective event, editation of XML file (change the name of parent EVH process to NonRunning.EVH) and then XML import.

The other way can be used if noone is using (referencing) the respective event (which can be verified via CNF - icon Object references). Create a new event as a copy of your event, but change the parent to NonRunning.EVH. Then delete the original event (this step fails, if the event is used - e.g. by a scheme or referenced in a structure variable).This way is faster and you don’t have to mess with editing of XML file :slight_smile: