There can be occasions when we want to add variables dynamically i.e In this example we want to configure the ECF_LOGHOST to the machine where the job is running. ECF_LOGHOST is used by the log server, to view the running output in the GUI.
example.ecf
%include <head.h> ecflow_client --alter add variable ECG_LOGHOST %HOST% %ECF_NAME% ecflow_client --alter add variable ECG_LOGPORT 9316 %ECF_NAME% .... .... ecflow_client --alter delete variable ECG_LOGHOST %ECF_NAME% ecflow_client --alter delete variable ECG_LOGPORT %ECF_NAME% %include <tail.h>
All this works, but it does add a lot of overhead.
In ecflow 5, we can now add/remove variable with the standard child commands init and complete. If the variable of same name already exists, it is updated.
heah.h
...... ecflow_client --init=$$ --add "ECF_LOGHOST=%HOST%" "ECF_LOGPORT=9316"
The removing is optional.
tail.h
.... ecflow_client --complete --remove ECF_LOGHOST ECF_LOGPORT