bree icon indicating copy to clipboard operation
bree copied to clipboard

Bree applied to data ingest

Open jvanek opened this issue 1 year ago • 1 comments

Hi all,

We have a quite complex platform to ingest sports data. We need to find (or develop) a tool which would be able to:

  • start a long running task (1-2 hours) programmatically, the start comes from another part of our platform
  • ensure periodically (every 2 min) that this task is still correctly running
  • ensure after a given time this same task is not stuck or running indefinitely (let's say after 3-4 hours)
  • know if/when the task is finished
  • be able to kill the task if it goes in infinite loop

There is in fact only one and same task for every launch, only the parameters change, so I don't need to have multiple jobs defined in jobs directory as I have seen but there can be several tasks launched at the same time.

I feel Bree could do the job very well, but I haven't seen any example how a job could be launched programmatically; all samples show job definitions at start and then the framework is left in async mode until all is done.

Would you mind to give me some very short example how I could achieve my constraints mentioned above please ? Or if I can do what I need with Bree framework ? Maybe there is a simpler solution ...

Thanks Josef

jvanek avatar Apr 24 '23 08:04 jvanek

Hi @jvanek. Please take a look at the types file where you can find all functions, options, and interfaces available in the library. https://github.com/breejs/bree/blob/master/types/index.d.ts

Specifically, you can use bree.add(myJob); to add a job to an existing Bree instance. Once a job is added, it will need to be started in order for it to run based on your schedule.

Hope this helps.

YeomansIII avatar May 11 '23 16:05 YeomansIII