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

Remove job context. #2373

Merged

Conversation

JDarDagran
Copy link
Contributor

@JDarDagran JDarDagran commented Jan 20, 2023

Signed-off-by: Jakub Dardzinski kuba0221@gmail.com

Add call to API in frontend.
Add tests.

Signed-off-by: Jakub Dardzinski kuba0221@gmail.com

Problem

Closes: #2230

Solution

This PR removes use of job context. It also adds 2 endpoints for job/run facets per run. Those are called from web components to replace job context with SQLJobFacet.

There is also a lot of code removal. It appears that plenty of code was marked as uncovered due to @NonNull annotation and caused issues to achieve code coverage goal. According to lombok docs I've added lombok.nonNull.exceptionType=JDK to skip coverage checks on those annotations.

Checklist

  • You've signed-off your work
  • Your changes are accompanied by tests (if relevant)
  • Your change contains a small diff and is self-contained
  • You've updated any relevant documentation (if relevant)
  • You've updated the CHANGELOG.md with details about your change under the "Unreleased" section (if relevant, depending on the change, this may not be necessary)
  • You've versioned your .sql database schema migration according to Flyway's naming convention (if relevant)
  • You've included a header in any source code files (if relevant)

@boring-cyborg boring-cyborg bot added the api API layer changes label Jan 20, 2023
@JDarDagran JDarDagran force-pushed the replace-job-context branch 5 times, most recently from d9daa4e to dbbec0c Compare January 20, 2023 11:04
@codecov
Copy link

codecov bot commented Jan 20, 2023

Codecov Report

Merging #2373 (d1af84c) into main (dbdbcc3) will increase coverage by 6.49%.
The diff coverage is 90.47%.

@@             Coverage Diff              @@
##               main    #2373      +/-   ##
============================================
+ Coverage     77.11%   83.61%   +6.49%     
+ Complexity     1234     1214      -20     
============================================
  Files           228      231       +3     
  Lines          5572     5522      -50     
  Branches        447      266     -181     
============================================
+ Hits           4297     4617     +320     
+ Misses          775      762      -13     
+ Partials        500      143     -357     
Impacted Files Coverage Δ
...i/src/main/java/marquez/api/models/JobVersion.java 100.00% <ø> (+29.41%) ⬆️
api/src/main/java/marquez/common/Utils.java 93.91% <ø> (+5.25%) ⬆️
...src/main/java/marquez/common/models/DatasetId.java 100.00% <ø> (+18.18%) ⬆️
api/src/main/java/marquez/db/Columns.java 79.74% <ø> (ø)
api/src/main/java/marquez/db/JobDao.java 100.00% <ø> (ø)
api/src/main/java/marquez/db/JobFacetsDao.java 100.00% <ø> (+35.71%) ⬆️
api/src/main/java/marquez/db/JobVersionDao.java 98.38% <ø> (+7.34%) ⬆️
api/src/main/java/marquez/db/RunFacetsDao.java 100.00% <ø> (+19.04%) ⬆️
...arquez/db/mappers/ExtendedJobVersionRowMapper.java 80.00% <ø> (+7.27%) ⬆️
...rc/main/java/marquez/db/mappers/JobDataMapper.java 100.00% <ø> (+12.50%) ⬆️
... and 142 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

"""
SELECT
run_uuid,
JSON_AGG(event -> 'run' -> 'facets' ORDER BY event_time) AS facets
Copy link
Collaborator

@pawel-big-lebowski pawel-big-lebowski Jan 20, 2023

Choose a reason for hiding this comment

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

if we were able to merge #2355 before, it would be great to make use of run_facets_view.

Copy link
Member

Choose a reason for hiding this comment

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

@JDarDagran we were able to ;)


@EqualsAndHashCode
@ToString
public final class Facets {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it is run related, then consider calling it RunFacets.

@@ -0,0 +1,3 @@
/* SPDX-License-Identifier: Apache-2.0 */

ALTER TABLE job_versions DROP COLUMN job_context_uuid;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's drop column in the next version - this would prevent rollback if the feature would be buggy.

Copy link
Member

@wslulciuc wslulciuc left a comment

Choose a reason for hiding this comment

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

@JDarDagran I think adding an endpoint for obtaining facets for a given run ID is a great addition to the Marquez API, but can we introduce the endpoint in a separate PR (to limit scope)? I've also provided some feedback on the runs facet endpoint.

@ExceptionMetered
@GET
@Produces(APPLICATION_JSON)
@Path("/run/{id}")
Copy link
Member

@wslulciuc wslulciuc Jan 31, 2023

Choose a reason for hiding this comment

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

I would add the endpoint to obtain facets for a given run to RunResource. That is, to receive a run, we have the endpoint:

GET /api/v1/jobs/runs/{id}

Similarly, to obtain facets for a given run, I would follow the same pattern:

GET /api/v1/jobs/runs/{id}/facets

@JDarDagran
Copy link
Contributor Author

@JDarDagran I think adding an endpoint for obtaining facets for a given run ID is a great addition to the Marquez API, but can we introduce the endpoint in a separate PR (to limit scope)?

@wslulciuc Normally I would agree. However, if we don't add job facet endpoint in this PR we have no viable source of data to replace job context with. The closest one would be /api/v1/events/lineage but:

  1. it does not allow to filter per run id
  2. already has performance issues. It would add more if we'd need to filter results from the endpoint to match given run id (as per 1.)
    For that reason I think this PR would less readable + less performant when introducing the endpoints in separate PR.

I do agree with your feedback on run facets endpoint, will apply to it.

web/src/helpers/facets.ts Outdated Show resolved Hide resolved
web/src/helpers/facets.ts Outdated Show resolved Hide resolved
web/src/helpers/facets.ts Outdated Show resolved Hide resolved
web/src/helpers/facets.ts Outdated Show resolved Hide resolved
web/src/helpers/facets.ts Outdated Show resolved Hide resolved
web/src/store/reducers/facets.ts Show resolved Hide resolved
@tito12
Copy link
Contributor

tito12 commented Feb 1, 2023

Also I am getting error on Graph view - "Something went wrong while fetching job facets". Maybe I don't have some data?

@JDarDagran JDarDagran force-pushed the replace-job-context branch 5 times, most recently from 6e51401 to 2742344 Compare February 19, 2023 22:14
Copy link
Collaborator

@pawel-big-lebowski pawel-big-lebowski left a comment

Choose a reason for hiding this comment

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

I cannot speak for webbev part, but the backend part seems good to me.
I've included some minor comments.
I think Java client is missing Run/Job facets added in service package, however this can be added later on in separate PR as this one already got pretty big.

🚀 👍 💯

api/src/main/java/marquez/db/RunDao.java Outdated Show resolved Hide resolved
api/src/main/java/marquez/db/RunDao.java Outdated Show resolved Hide resolved
@JDarDagran JDarDagran force-pushed the replace-job-context branch 7 times, most recently from 83304d4 to 3f7ce31 Compare February 21, 2023 08:36
@JDarDagran JDarDagran requested a review from wslulciuc February 21, 2023 08:50
Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com>

Add call to API in frontend.
Add tests.

Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com>

Update javadocs.

Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com>

Apply spotless fixes.

Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com>

Remove FacetResource.
Split react functions to each component.

Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com>

Add more tests for JobResource.
Update OpenAPI spec.

Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com>

Add more tests.

Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com>

Add lombok option to skip coverage check on NonNull.

Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com>

Move find facets methods to corresponding daos.

Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com>
@JDarDagran JDarDagran requested review from tito12 and removed request for wslulciuc February 21, 2023 10:00
Copy link
Member

@wslulciuc wslulciuc left a comment

Choose a reason for hiding this comment

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

Thanks for the clean up @JDarDagran! 🥇 💯 🚀

Copy link
Contributor

@tito12 tito12 left a comment

Choose a reason for hiding this comment

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

Looks nice :)

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

Successfully merging this pull request may close these issues.

Only first job context is taken into consideration.
5 participants