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

feat(controller): build dataset in server #2497

Merged
merged 50 commits into from
Jul 19, 2023

Conversation

goldenxinxing
Copy link
Contributor

@goldenxinxing goldenxinxing commented Jul 11, 2023

Description

  1. add new operation 'ds_build_and_upload' in entrypoint
  2. add dataset build API and support GC the unused files in build record which is succeess
  3. add oss signedUrl API
  4. add log API(Online and offline)
  5. optimise the job and pod eventHandler's dispatch logic(do different operation based on their respective label)

Modules

  • UI
  • Controller
  • Agent
  • Client
  • Python-SDK
  • Others

Checklist

  • run code format and lint check
  • add unit test
  • add necessary doc

@codecov
Copy link

codecov bot commented Jul 12, 2023

Codecov Report

Merging #2497 (20f5a52) into main (076a8b2) will decrease coverage by 8.23%.
The diff coverage is 44.16%.

@@             Coverage Diff              @@
##               main    #2497      +/-   ##
============================================
- Coverage     91.24%   83.01%   -8.23%     
- Complexity        0     2646    +2646     
============================================
  Files           102      448     +346     
  Lines         11785    24326   +12541     
  Branches          0     1452    +1452     
============================================
+ Hits          10753    20194    +9441     
- Misses         1032     3476    +2444     
- Partials          0      656     +656     
Flag Coverage Δ
controller 75.10% <44.16%> (?)
standalone 91.36% <ø> (+0.12%) ⬆️
unittests 91.36% <ø> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...i/starwhale/mlops/api/DatasetBuildLogWsServer.java 0.00% <0.00%> (ø)
...java/ai/starwhale/mlops/api/DatasetController.java 76.68% <0.00%> (ø)
.../ai/starwhale/mlops/api/FileStorageController.java 0.00% <0.00%> (ø)
...arwhale/mlops/configuration/RunTimeProperties.java 100.00% <ø> (ø)
...ataset/build/converter/BuildRecordVoConverter.java 0.00% <0.00%> (ø)
...domain/dataset/build/mapper/BuildRecordMapper.java 0.00% <0.00%> (ø)
...hale/mlops/domain/system/SystemSettingService.java 67.74% <ø> (ø)
.../starwhale/mlops/schedule/k8s/JobEventHandler.java 63.70% <12.50%> (ø)
...iguration/security/DatasetBuildTokenValidator.java 23.52% <23.52%> (ø)
...ps/domain/dataset/build/log/BuildLogCollector.java 27.27% <27.27%> (ø)
... and 11 more

... and 330 files with indirect coverage changes

@goldenxinxing goldenxinxing self-assigned this Jul 12, 2023
@goldenxinxing goldenxinxing force-pushed the feat/build_dataset_in_server branch 2 times, most recently from 39349db to d359e70 Compare July 12, 2023 11:25
@goldenxinxing goldenxinxing changed the title WIP feat(controller): build dataset in server feat(controller): build dataset in server Jul 13, 2023
@goldenxinxing goldenxinxing marked this pull request as ready for review July 13, 2023 11:07
@anda-ren
Copy link
Member

maybe we could reuse the job-task framework, so that there is no bother to write log collector/status watcher and token validator

@goldenxinxing
Copy link
Contributor Author

goldenxinxing commented Jul 17, 2023

maybe we could reuse the job-task framework, so that there is no bother to write log collector/status watcher and token validator

Yes, but this may be need extract some common logics, like whether to sync the job to datastore\ which resourcePool to use(image and dataset may use private resource) ..etc. so i will use annother PR(#2509) to fix them.

Copy link
Member

@tianweidut tianweidut left a comment

Choose a reason for hiding this comment

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

LGTM

@tianweidut tianweidut merged commit 7c7ff4f into star-whale:main Jul 19, 2023
42 checks passed
Comment on lines +446 to +447
var buildings = buildRecordMapper.selectBuildingInOneProjectForUpdate(
project.getId(), request.getDatasetName());
Copy link
Contributor

Choose a reason for hiding this comment

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

This line means we can apply two buildings with case-sensitive dataset names like mnist and Mnist?
And it seems that we do not allow this in Line 440:

if (!ds.getDatasetName().equalsIgnoreCase(request.getDatasetName())) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, you are right, i will fix it

Comment on lines +463 to +464
var res = buildRecordMapper.insert(entity) > 0;
if (res) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to check the return value?

Comment on lines +538 to +544
var dataset = datasetMapper.findByName(record.getDatasetName(), record.getProjectId(), false);
if (dataset != null) {
var version = datasetVersionMapper.findByLatest(dataset.getId());
if (version != null) {
datasetVersionMapper.updateShared(version.getId(), true);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Make an issue to fix the race condition when the other user updates the dataset?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, #2523

Comment on lines +48 to +52
if (dataRootPath.endsWith("/")) {
this.dataRootPath = dataRootPath;
} else {
this.dataRootPath = dataRootPath + "/";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Check if the root path is short enough to make sure that the generatePathPrefix less than 255?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@goldenxinxing goldenxinxing deleted the feat/build_dataset_in_server branch August 31, 2023 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants