fieldryand / goflow

Simple but powerful DAG scheduler and dashboard
MIT License
391 stars 31 forks source link

runJob method and cron need to export #45

Open zengzhengrong opened 11 months ago

zengzhengrong commented 11 months ago

I need cron second job and manually run job

cron.New(cron.WithSeconds())
/ runJob tells the engine to run a given job and returns
// the corresponding jobRun.
func (g *Goflow) runJob(jobName string) *jobRun {
    // generate the job
    job := g.Jobs[jobName]()

    // create and persist a new jobrun record
    jobrun := job.newJobRun()
    persistNewJobRun(g.Store, jobrun)
    indexJobRuns(g.Store, jobrun)

    // start running the job
    go job.run()
fieldryand commented 10 months ago

Thanks for these suggestions!

I looked at your fork and I think the WithSeconds option is a good idea. Do you want to open a PR?

I am not so sure about exporting runJob() because exposing this as part of the library API could become fragile later. A manual job run is possible, if you start the Goflow engine and send a request to the web API with POST /api/jobs/{jobname}/submit.

zengzhengrong commented 10 months ago

Thanks for these suggestions!

I looked at your fork and I think the WithSeconds option is a good idea. Do you want to open a PR?

I am not so sure about exporting runJob() because exposing this as part of the library API could become fragile later. A manual job run is possible, if you start the Goflow engine and send a request to the web API with POST /api/jobs/{jobname}/submit.

It is necessary to export a runJob, flow job is written in go code, and in some cases, run one job done and finally to execute another job,use web api is uselessness cost

fieldryand commented 10 months ago

OK, thanks for the clarification. I am currently working on a v3 release and I will evaluate whether this can be a feature in that release.