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

FINERACT-2119: Address jobs by name #4037

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

marta-jankovics
Copy link
Contributor

Description

[Describe the changes made and why they were made.

Ignore if these details are present on the associated Apache Fineract JIRA ticket.](https://issues.apache.org/jira/browse/FINERACT-2119)

New field on job table:
short_name VARCHAR(8) NNULL, Unique
Example: ACC_AATR (Add Accrual Transactions) - first part is like a namespace, second part is specific for the job

namespaces:
LA: Loan Account
SA: Savings Account
SH: Shares
ACC: Accounting
STI: Standing Instruction
EM: Email sending
SMS: Sms sending
BDT: Business Date
COM: Commands
EXE: External Events

New API endpoints:
These API endpoints were added by the story above.
GET /v1/jobs/short-name/{shortName}
GET /v1/jobs/short-name/{shortName}/runhistory
POST /v1/jobs/short-name/{shortName}
PUT /v1/jobs/short-name/{shortName}

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per https://github.com/apache/fineract/#pull-requests

  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.

  • Create/update unit or integration tests for verifying the changes made.

  • Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.

  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes

  • Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)

FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adamsaghy adamsaghy merged commit 3aaa2ff into apache:develop Aug 28, 2024
9 checks passed
Comment on lines +45 to +50
<changeSet author="acme" id="2">
<update tableName="job">
<column name="short_name" value="ACM_NOOP"/>
<where>name='Acme Noop Job'</where>
</update>
</changeSet>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamsaghy @marta-jankovics

I am currently working on a custom module in another PR (#3994), and when I rebased the branch with the develop branch and ran the custom Docker image, I encountered the following error:

fineract-fineract-1  | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tenantDatabaseUpgradeService' defined in URL [jar:file:/app/libs/fineract-provider-0.1.0-SNAPSHOT-plain.jar!/org/apache/fineract/infrastructure/core/service/migration/TenantDatabaseUpgradeService.class]: liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset db/custom-changelog/0001_acme_loan_job.xml::1::acme:
fineract-fineract-1  |      Reason: liquibase.exception.DatabaseException: ERROR: null value in column "short_name" of relation "job" violates not-null constraint
fineract-fineract-1  |   Detail: Failing row contains (40, Acme Noop Job, Acme Noop Job, 0 1 0 1/1 * ? *, 2024-08-29 15:30:47.958143, 5, null, null, null, Acme Noop Job _ DEFAULT, null, f, f, t, 0, f, 1, t, null). [Failed SQL: (0) INSERT INTO public.job (name, display_name, cron_expression, create_time, task_priority, group_name, previous_run_start_time, job_key, initializing_errorlog, is_active, currently_running, updates_allowed, scheduler_group, is_misfired, node_id, is_mismatched_job) VALUES ('Acme Noop Job', 'Acme Noop Job', '0 1 0 1/1 * ? *', NOW(), 5, NULL, NULL, 'Acme Noop Job _ DEFAULT', NULL, FALSE, FALSE, TRUE, 0, FALSE, 1, TRUE)]

Could you please explain why this occurred and how I can resolve it?

Note

I am running docker-compose-api-v3.yml which uses Postgres image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the problem might be the order of execution of the liquibase scripts. @marta-jankovics What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0001_acme_loan_job.xml
should run before
0146_add_final_constraints.xm
make sure that in
db/changelog/db.changelog-master.xml
your module changeling-master.xml is listed before
tenant/final-changelog-tenant.xml

Copy link
Contributor Author

@marta-jankovics marta-jankovics Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that scripts marked with custom_changelog run after the normal run was finished. This is not correct. I'll fix this with a a small PR today.
See #4041

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.

3 participants