Timer monitor

Use this forum to request features. Maybe you'll get lucky!
Post Reply
3dsasha
Posts: 21
Joined: Tue Dec 15, 2020 3:30 pm

Timer monitor

Post by 3dsasha »

I never stop admiring FFASTrans. Thank you, developers. :P
I would like to suggest an idea for consideration - creating a Monitoring Processor that can be launched on a timer with various settings. For example, at certain times of day, at certain hours, minutes, and so on. And/or at certain time intervals. You may ask, why do we need it? For instance, it can help ease the workload of file systems at specific intervals, or meet other needs.
Currently, I am working on setting up Long Polling bot API mode for various messengers. For instance, I have written a basic custom node powershell handler via HTTP API that fetches sent video to the FFASTrans ecosystem. However, I cannot yet find an elegant solution to run the workflow via the ticking method without using a growing number of files or file size through Folder Monitor.
Maybe someone can suggest a brilliant solution :idea: for the latest version of FFASTrans? :?:
Thank you."
emcodem
Posts: 1646
Joined: Wed Sep 19, 2018 8:11 am

Re: Timer monitor

Post by emcodem »

Hey sasha,

sure, this kind of feature request is popping up from time to time and i believe it is one of the things being worked on in a possible next release (not sure what exactly the final result will be able to do and what not). Unfortunately the next FFAStrans Core feature release is currently postponed for unknown time.

There is a start/stop API method, but when i just tested for you, it didnt work at all so i post the "unsupported" but working solution that you can use until the next update which has the features you need (or longer most likely).

In webinterface, we have the scheduler main menu item. It does not only start jobs in a given frequency (which i use for live recording daily for example), but it can also just execute a custom script (called CONDITION) in the specified frequencies.

Here is a script that can start/stop the watching mechanism of workflows (based on wf guid), it assumes that webinterface is running on the same server as ffastrans.

Code: Select all

var fs = require("fs");
var workflows = [
  		"20230413-2219-0016-931d-50040dd8c772",
                "20230319-0520-5413-242f-fd76be2a4200"
                ];
var action = "stop"; // "start", "stop", "enable" or "disable".
var ffas_root = "C:\\FFAStrans1.3.1\\Processors\\db\\cache\\status\\";

startWorkflows();
//stopWorkflows();

function startWorkflows(){
  for (var i=0;i<workflows.length;i++){
      fs.writeFileSync(ffas_root + ".start~" + workflows[i],"");
  }
}

function stopWorkflows(){
  for (var i=0;i<workflows.length;i++){
      fs.unlinkSync(ffas_root + ".start~" + workflows[i],"");
  }
}
Of course you need to change the ffas_root path to your path.

Note, If you just execute a script instead of starting jobs with webint scheduler, you just fill out the frequency and enable the thing, done. "next run" column will indicate when the stuff is execute next time.
You will notice, all that script does is to write or delete an empty file called .start~%worfklowguid% to a special folder in ffastrans, this is how this works internally. Culprint is that a possible open GUI might not notice the change, you'll need to restart the workflow editor to see if it worked. (or just test if the watchfolders still work after executing the stop script)

For using this, you will need to schedule at least 2 jobs, one for starting, the other for stopping. You must comment the corresponding function in the script (startWorkflows/stopWorkflows).

Of course, if you prefer to do all of that in python, just go for it but i guess using the existing scheduler will remove the biggest part of the work for you. In case you want some example how to start a python script from the scheduler, just ask :D
emcodem, wrapping since 2009 you got the rhyme?
Post Reply