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

Spring batch job enabled #144

Merged
merged 2 commits into from
Sep 23, 2020

Conversation

psavva
Copy link
Contributor

@psavva psavva commented Sep 22, 2020

This PR will remove the need to run -Dspring.batch.job.enabled=false and similar when running the hapi fhir jpa server before a few days ago.

Benefits: Avoid changing build process, and adding command line built parameters when it's not needed

Changes, defaulted the spring batch job enabled to false in application.yaml

@psavva
Copy link
Contributor Author

psavva commented Sep 23, 2020

@jamesagnew could you please review this PR as the recent changes to the implementation requires a change to the building process when it can be avoided

@jamesagnew
Copy link
Contributor

What is the root cause here?

We shouldn't be disabling the batch job processor, it is needed in order to run batch jobs... HAPI won't work properly without it.

@jamesagnew
Copy link
Contributor

@jvitrifork I assume this instruction was added when the boot stuff was added?

@psavva
Copy link
Contributor Author

psavva commented Sep 23, 2020

The current instructions is to disable it.
Please see https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/README.md#using-jetty

If it's to be enabled by default, then more parameters are missing. Please see #136

Caused by: org.springframework.batch.core.JobParametersInvalidException: There must be a valid number for readChunkSize, which is at least 1. You must include [resourceTypes] as a Job Parameter

@seanmcilvenna seanmcilvenna merged commit 7550346 into hapifhir:master Sep 23, 2020
@jamesagnew
Copy link
Contributor

Why is this instruction needed though? We weren't recommending that people disable the job executor 2 weeks ago, and we make basic assumptions in hapi JPA that it is running.

Making it easier to disable the executor is a band aid that will just make people have more subtle problems.

@seanmcilvenna this should be reverted IMO. We need to address the root cause.

@tadgh
Copy link
Collaborator

tadgh commented Sep 23, 2020

Just wanted to chime in here, this toggle, spring.batch.job.enabled=false is a specific boot setting to prevent ALL jobs from being run on boot, which for some reason, is SpringBoot's autoconfiguration default. https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.html

@tadgh
Copy link
Collaborator

tadgh commented Sep 23, 2020

I don't think this disables batch itself, just the spring-boot magic of auto-running all configured jobs at context boot time.

Edit: As an aside, what a terrible name for a property, because it does read as though it is literally disabling all of spring batch

seanmcilvenna added a commit that referenced this pull request Sep 23, 2020
@seanmcilvenna
Copy link
Collaborator

seanmcilvenna commented Sep 23, 2020

@jamesagnew I have reverted... but I can definitely attest that I was not able to run hapi-fhir-jpaserver-starter without disabling spring.batch.job.enabled as well. The build is basically broken without this. So, I wonder if maybe it would be better to leave the PR merged, but create another PR that fixes the underlying issue and removes the spring.batch.job.enabled=false stuff...???

@jamesagnew
Copy link
Contributor

Sorry - Given @tadgh it seems like I may have misunderstood what that setting was doing.

If it isn't actually disabling the batch processing, making it the default seems ok

@seanmcilvenna
Copy link
Collaborator

Ok. I'll revert my revert. LoL

@seanmcilvenna
Copy link
Collaborator

Ok phew there was nothing to revert. "master" is still good, and has this changed merged into it.

@jvitrifork
Copy link
Collaborator

A little late to the party here I guess. I agree with @tadgh - this is a trigger on the Spring Boot AutoConfiguration part. Until the design or the proper Bean definitions as the required Batch job configurations are changed in HAPI FHIR, or added to this project, the default should be to disable spring.batch.job - and I agree that adding this to the yml file is the way to go (wonder why I didn't do this myself?). The thing that now makes me think, is that this setting is now crucial in the yml file as the server in its current state will not start up if this is set to true - just as crucial as having the right db address and so on

@jvitrifork
Copy link
Collaborator

Perhaps a line of doc in the config file would be proper to add

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

Successfully merging this pull request may close these issues.

None yet

5 participants