Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runJob method and cron need to export #45

Open
zengzhengrong opened this issue Dec 27, 2023 · 3 comments
Open

runJob method and cron need to export #45

zengzhengrong opened this issue Dec 27, 2023 · 3 comments

Comments

@zengzhengrong
Copy link
Contributor

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
Copy link
Owner

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 zengzhengrong mentioned this issue Jan 13, 2024
@zengzhengrong
Copy link
Contributor Author

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants