Page 1 of 1

Concurrent write to text files

Posted: Mon Nov 24, 2014 1:26 pm
by ArielRauch
Hi,

I want to document all the metadata of my flows to a structured text files in order to upload them later to a database. (I do not have the database module)



I plan to write a script which extracts the current values of the metadata of a specific dataset and "appends" them to a text file. From time to time this file is copied away in order to upload it (probably another switch script) and all consequent writes will be written to a new file.



My question is whether the "append to file" action might interfere with concurrent ones and if so if I have to configure the script serialized.





Thanks



Ariel

Concurrent write to text files

Posted: Mon Nov 24, 2014 1:42 pm
by freddyp
Setting the execution mode of the script to "Serialized" is a safe approach.



Alternatively you could put the opening of the file in a loop until the opening does not throw an exception. Do not use a while loop, but a for loop (with a reasonable number of iterations) to avoid an endless loop, and perhaps use s.sleep inside the loop too.



Freddy