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

Revert to using datasetList in jobParams #1616

Open
wants to merge 1 commit into
base: release-jobs
Choose a base branch
from

Conversation

despadam
Copy link

@despadam despadam commented Oct 16, 2024

  1. Revert to using the following inside jobParams:
datasetList: [
    {
        pid: 'someDatasetPid',
        files: [ 'file1', 'file2' ]
    }
]
  1. Fix bug in src/app/datasets/archiving.service.ts that was not allowing job creation from the frontend.

Summary by Sourcery

Revert to using 'datasetList' in job parameters and fix a bug in the archiving service to allow job creation from the frontend.

Bug Fixes:

  • Fix a bug in the archiving service that prevented job creation from the frontend.

Enhancements:

  • Refactor job parameter structure to use 'datasetList' instead of 'datasetIds' across multiple components and services.

Copy link

sourcery-ai bot commented Oct 16, 2024

Reviewer's Guide by Sourcery

This pull request reverts the job parameters structure to use a 'datasetList' instead of 'datasetIds'. It also fixes a bug in the archiving service that was preventing job creation from the frontend. The changes primarily affect how datasets and their associated files are handled in job creation and processing.

Updated class diagram for Job parameters

classDiagram
    class Job {
        +String createdBy
        +Date createdAt
        +String type
        +JobParams jobParams
    }
    class JobParams {
        +List~Dataset~ datasetList
    }
    class Dataset {
        +String pid
        +List~String~ files
    }
    JobParams --> Dataset
    Dataset "1" -- "*" String : files
    note for JobParams "Reverted to using datasetList instead of datasetIds"
Loading

File-Level Changes

Change Details Files
Revert job parameters structure to use 'datasetList' instead of 'datasetIds'
  • Update jobParams to include a datasetList array with objects containing pid and files
  • Modify job creation logic to populate datasetList with dataset PIDs and file lists
  • Update test cases to reflect the new datasetList structure
src/app/datasets/admin-tab/admin-tab.component.ts
src/app/datasets/archiving.service.spec.ts
src/app/datasets/datafiles/datafiles.component.ts
src/app/datasets/archiving.service.ts
src/app/state-management/effects/jobs.effects.spec.ts
src/app/state-management/reducers/jobs.reducer.spec.ts
src/app/state-management/selectors/jobs.selectors.spec.ts
Fix bug in archiving service preventing job creation from frontend
  • Remove createdBy and unnecessary comment from archiving service
  • Update job creation logic in datafiles component to include selected files
src/app/datasets/archiving.service.ts
src/app/datasets/datafiles/datafiles.component.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @despadam - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider conducting a comprehensive review of all job-related code to ensure consistent handling of the new datasetList structure throughout the codebase.
  • The removal of createdBy and createdAt fields in ArchivingService.ts seems unintentional. Please verify if this was intended and adjust accordingly to maintain consistent job metadata.
  • While the new structure provides more granular control, ensure that empty file lists are handled consistently across all affected components (e.g., using empty arrays vs. omitting the files property).
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Hi @despadam! 👋

@sourcery-ai is now installed on this repository.

We found this recent PR of yours and reviewed it to show you what Sourcery can do.

If you want to review another PR, just comment with @sourcery-ai review

Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

datasetList: [
{
pid: this.datasetPid,
files: this.getSelectedFiles(),
Copy link

Choose a reason for hiding this comment

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

suggestion (performance): Store result of getSelectedFiles() in a variable

To avoid potential multiple calls to getSelectedFiles(), consider storing its result in a variable before using it in the job parameters.

const selectedFiles = this.getSelectedFiles();
datasetList: [
  {
    pid: this.datasetPid,
    files: selectedFiles,
  },
],

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.

1 participant