Variable "previous hour / day / month / year"

Questions and answers on how to get the most out of FFAStrans
Post Reply
artjuice
Posts: 36
Joined: Mon Mar 20, 2023 11:33 pm

Variable "previous hour / day / month / year"

Post by artjuice »

Hi,

I want to make variable for previous hour / day / month / year, and need help with this.

The files contain information about the date in the file name, this works for the files of the current month, but there is a problem when a new month arrives - files from the last day of the previous month are ignored, because the workflow starts at a certain time, and not constantly.
Attach my workflow
test mon.json
(6.95 KiB) Downloaded 7 times
emcodem
Posts: 1743
Joined: Wed Sep 19, 2018 8:11 am

Re: Variable "previous hour / day / month / year"

Post by emcodem »

Hey there,

so your current include filename expression is

Code: Select all

*%i_mon%%i_yr%-*.mxf
And you run the workflow only between midnight and 8:59 a.m.

Basically there are no smart inbuilt solutions for this, e.g. you cannot do calculations like month -1 or similar.
To cover the basics, i have to ask if its not possible for you to just watch for

Code: Select all

*%i_yr%-*.mxf
But even if you could, you would miss the files from 31. December i think.

The best thing that comes to my mind change to this include filter, it contains all months up to 2050 :D

Code: Select all

*112024-*.mxf|*122024-*.mxf|*012025-*.mxf|*022025-*.mxf|*032025-*.mxf|*042025-*.mxf|*052025-*.mxf|*062025-*.mxf|*072025-*.mxf|*082025-*.mxf|*092025-*.mxf|*102025-*.mxf|*112025-*.mxf|*122025-*.mxf|*012026-*.mxf|*022026-*.mxf|*032026-*.mxf|*042026-*.mxf|*052026-*.mxf|*062026-*.mxf|*072026-*.mxf|*082026-*.mxf|*092026-*.mxf|*102026-*.mxf|*112026-*.mxf|*122026-*.mxf|*012027-*.mxf|*022027-*.mxf|*032027-*.mxf|*042027-*.mxf|*052027-*.mxf|*062027-*.mxf|*072027-*.mxf|*082027-*.mxf|*092027-*.mxf|*102027-*.mxf|*112027-*.mxf|*122027-*.mxf|*012028-*.mxf|*022028-*.mxf|*032028-*.mxf|*042028-*.mxf|*052028-*.mxf|*062028-*.mxf|*072028-*.mxf|*082028-*.mxf|*092028-*.mxf|*102028-*.mxf|*112028-*.mxf|*122028-*.mxf|*012029-*.mxf|*022029-*.mxf|*032029-*.mxf|*042029-*.mxf|*052029-*.mxf|*062029-*.mxf|*072029-*.mxf|*082029-*.mxf|*092029-*.mxf|*102029-*.mxf|*112029-*.mxf|*122029-*.mxf|*012030-*.mxf|*022030-*.mxf|*032030-*.mxf|*042030-*.mxf|*052030-*.mxf|*062030-*.mxf|*072030-*.mxf|*082030-*.mxf|*092030-*.mxf|*102030-*.mxf|*112030-*.mxf|*122030-*.mxf|*012031-*.mxf|*022031-*.mxf|*032031-*.mxf|*042031-*.mxf|*052031-*.mxf|*062031-*.mxf|*072031-*.mxf|*082031-*.mxf|*092031-*.mxf|*102031-*.mxf|*112031-*.mxf|*122031-*.mxf|*012032-*.mxf|*022032-*.mxf|*032032-*.mxf|*042032-*.mxf|*052032-*.mxf|*062032-*.mxf|*072032-*.mxf|*082032-*.mxf|*092032-*.mxf|*102032-*.mxf|*112032-*.mxf|*122032-*.mxf|*012033-*.mxf|*022033-*.mxf|*032033-*.mxf|*042033-*.mxf|*052033-*.mxf|*062033-*.mxf|*072033-*.mxf|*082033-*.mxf|*092033-*.mxf|*102033-*.mxf|*112033-*.mxf|*122033-*.mxf|*012034-*.mxf|*022034-*.mxf|*032034-*.mxf|*042034-*.mxf|*052034-*.mxf|*062034-*.mxf|*072034-*.mxf|*082034-*.mxf|*092034-*.mxf|*102034-*.mxf|*112034-*.mxf|*122034-*.mxf|*012035-*.mxf|*022035-*.mxf|*032035-*.mxf|*042035-*.mxf|*052035-*.mxf|*062035-*.mxf|*072035-*.mxf|*082035-*.mxf|*092035-*.mxf|*102035-*.mxf|*112035-*.mxf|*122035-*.mxf|*012036-*.mxf|*022036-*.mxf|*032036-*.mxf|*042036-*.mxf|*052036-*.mxf|*062036-*.mxf|*072036-*.mxf|*082036-*.mxf|*092036-*.mxf|*102036-*.mxf|*112036-*.mxf|*122036-*.mxf|*012037-*.mxf|*022037-*.mxf|*032037-*.mxf|*042037-*.mxf|*052037-*.mxf|*062037-*.mxf|*072037-*.mxf|*082037-*.mxf|*092037-*.mxf|*102037-*.mxf|*112037-*.mxf|*122037-*.mxf|*012038-*.mxf|*022038-*.mxf|*032038-*.mxf|*042038-*.mxf|*052038-*.mxf|*062038-*.mxf|*072038-*.mxf|*082038-*.mxf|*092038-*.mxf|*102038-*.mxf|*112038-*.mxf|*122038-*.mxf|*012039-*.mxf|*022039-*.mxf|*032039-*.mxf|*042039-*.mxf|*052039-*.mxf|*062039-*.mxf|*072039-*.mxf|*082039-*.mxf|*092039-*.mxf|*102039-*.mxf|*112039-*.mxf|*122039-*.mxf|*012040-*.mxf|*022040-*.mxf|*032040-*.mxf|*042040-*.mxf|*052040-*.mxf|*062040-*.mxf|*072040-*.mxf|*082040-*.mxf|*092040-*.mxf|*102040-*.mxf|*112040-*.mxf|*122040-*.mxf|*012041-*.mxf|*022041-*.mxf|*032041-*.mxf|*042041-*.mxf|*052041-*.mxf|*062041-*.mxf|*072041-*.mxf|*082041-*.mxf|*092041-*.mxf|*102041-*.mxf|*112041-*.mxf|*122041-*.mxf|*012042-*.mxf|*022042-*.mxf|*032042-*.mxf|*042042-*.mxf|*052042-*.mxf|*062042-*.mxf|*072042-*.mxf|*082042-*.mxf|*092042-*.mxf|*102042-*.mxf|*112042-*.mxf|*122042-*.mxf|*012043-*.mxf|*022043-*.mxf|*032043-*.mxf|*042043-*.mxf|*052043-*.mxf|*062043-*.mxf|*072043-*.mxf|*082043-*.mxf|*092043-*.mxf|*102043-*.mxf|*112043-*.mxf|*122043-*.mxf|*012044-*.mxf|*022044-*.mxf|*032044-*.mxf|*042044-*.mxf|*052044-*.mxf|*062044-*.mxf|*072044-*.mxf|*082044-*.mxf|*092044-*.mxf|*102044-*.mxf|*112044-*.mxf|*122044-*.mxf|*012045-*.mxf|*022045-*.mxf|*032045-*.mxf|*042045-*.mxf|*052045-*.mxf|*062045-*.mxf|*072045-*.mxf|*082045-*.mxf|*092045-*.mxf|*102045-*.mxf|*112045-*.mxf|*122045-*.mxf|*012046-*.mxf|*022046-*.mxf|*032046-*.mxf|*042046-*.mxf|*052046-*.mxf|*062046-*.mxf|*072046-*.mxf|*082046-*.mxf|*092046-*.mxf|*102046-*.mxf|*112046-*.mxf|*122046-*.mxf|*012047-*.mxf|*022047-*.mxf|*032047-*.mxf|*042047-*.mxf|*052047-*.mxf|*062047-*.mxf|*072047-*.mxf|*082047-*.mxf|*092047-*.mxf|*102047-*.mxf|*112047-*.mxf|*122047-*.mxf|*012048-*.mxf|*022048-*.mxf|*032048-*.mxf|*042048-*.mxf|*052048-*.mxf|*062048-*.mxf|*072048-*.mxf|*082048-*.mxf|*092048-*.mxf|*102048-*.mxf|*112048-*.mxf|*122048-*.mxf|*012049-*.mxf|*022049-*.mxf|*032049-*.mxf|*042049-*.mxf|*052049-*.mxf|*062049-*.mxf|*072049-*.mxf|*082049-*.mxf|*092049-*.mxf|*102049-*.mxf|*112049-*.mxf|*122049-*.mxf|*012050-*.mxf|*022050-*.mxf|*032050-*.mxf|*042050-*.mxf|*052050-*.mxf|*062050-*.mxf|*072050-*.mxf|*082050-*.mxf|*092050-*.mxf|*102050-*.mxf|*112050-*.mxf|*122050-*.mxf
Tested with a normal monitor processor watching in c:\temp for a filename like
test012025-test.mxf
It worked.
emcodem, wrapping since 2009 you got the rhyme?
artjuice
Posts: 36
Joined: Mon Mar 20, 2023 11:33 pm

Re: Variable "previous hour / day / month / year"

Post by artjuice »

Hi emcodem,
emcodem wrote: Fri Nov 01, 2024 5:03 pm The best thing that comes to my mind change to this include filter, it contains all months up to 2050 :D
Yeah, i know, it's easy, but not so interesting way ^_^ and also not so flexible.
I think to do this thru Python or PS script, but I do not fully understand how to correctly transfer this variable to the monitor node.
emcodem
Posts: 1743
Joined: Wed Sep 19, 2018 8:11 am

Re: Variable "previous hour / day / month / year"

Post by emcodem »

Yeah the monitoring is not very flexible and in my opinion it is also totally wrong how it is presented to the user, e.g. you insert the monitor folder processor into your workflow even if it has actually not anything to do with the job, each monitor processor runs completely disconnected in a separate process.
When monitoring has found something to process, it will create a job ticket which finally kicks off the real job (what you see in the workflow editor). It would be better presented to the user in a List just like most other transcoders do.
There is no way to "kick off a single run of the monitor".

E.g. the monitoring is not actually executed just because you submit a file to the monitor processor manually or from API(in this case the "processor" is just skipped).

Aside from that, if you like to change the include field dynamically with your own script, what you must do for it is to actually change the workflow json (accpet_files property) in Processors/db/configs/workflows/%wf_id%.json. This is very dirty and not something we can support in any way but it is very simple to do. You'd just need to check after updating ffastrans if what you do still works.

The only really clean solution that i see is to actually do the whole watching and download from ftp process on your own, e.g. by scheduling winscp. I do this in production for sftp servers. For this i built a job that first writes a winscp script and after that executes winscp which downloads the files into a local watchfolder. The winscp job is scheduled every minute by webinterface, the downloaded files are processed using normal local watchfolder).
After all, "complex monitoring and job starting" scenarious are the reason why webinterface job scheduler exists.
emcodem, wrapping since 2009 you got the rhyme?
Post Reply