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: make versions work with id #992

Merged
merged 16 commits into from
Oct 28, 2020
Merged

feat: make versions work with id #992

merged 16 commits into from
Oct 28, 2020

Conversation

nassiharel
Copy link
Contributor

@nassiharel nassiharel commented Oct 22, 2020

This change is Reviewable

@nassiharel nassiharel marked this pull request as ready for review October 25, 2020 14:53
@nassiharel
Copy link
Contributor Author

/deploy

@hkube-ci hkube-ci temporarily deployed to dev October 25, 2020 14:54 Inactive
Copy link
Contributor

@yehiyam yehiyam left a comment

Choose a reason for hiding this comment

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

Reviewed 25 of 25 files at r1.
Reviewable status: all files reviewed, 9 unresolved discussions (waiting on @nassiharel)


core/api-server/api/rest-api/app-server.js, line 69 at r1 (raw file):

🚀

really? :-)


core/api-server/api/rest-api/routes/v1/versions.js, line 21 at r1 (raw file):

id

id is the version or the tag?


core/api-server/api/rest-api/routes/v1/versions.js, line 37 at r1 (raw file):

    router.delete('/algorithms/:name/:id', logger(), async (req, res, next) => {
        const { id, name } = req.params;
        const response = await versionsService.deleteVersion({ id, name });

Is this route used to delete version or algorithm?


core/api-server/lib/service/algorithms.js, line 35 at r1 (raw file):

algorithmVersion

should be algorithmVersions


core/api-server/lib/service/algorithms.js, line 278 at r1 (raw file):

algorithm.options.debug

I don't think we need a version for debug.


core/api-server/lib/service/algorithms.js, line 278 at r1 (raw file):

!buildId

why not when there is a build? the version is created after the build is done?


core/api-server/lib/service/builds.js, line 183 at r1 (raw file):

    _formatDiff(algorithm) {
        const { fileInfo, env, gitRepository } = algorithm;

maybe add baseImage also?


core/api-server/tests/algorithms-store.js, line 1692 at r1 (raw file):

                const res3 = await request(req3);
                const res4 = await request(req4);
                const versions1 = res4.body.map(v => v.id).sort();

why do you need sort? versions are not returned in the order they were created?


core/api-server/tests/versions.js, line 295 at r1 (raw file):

            expect(res.body.error.message).to.equal(`version no-such Not Found`);
        });
        it('should succeed to tag version', async () => {

should add tests to delete tags and to change tags

Copy link
Contributor Author

@nassiharel nassiharel left a comment

Choose a reason for hiding this comment

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

Reviewable status: 11 of 36 files reviewed, 9 unresolved discussions (waiting on @yehiyam)


core/api-server/api/rest-api/app-server.js, line 69 at r1 (raw file):

Previously, yehiyam wrote…
🚀

really? :-)

:-)


core/api-server/api/rest-api/routes/v1/versions.js, line 21 at r1 (raw file):

Previously, yehiyam wrote…
id

id is the version or the tag?

version (uid length of 10)


core/api-server/api/rest-api/routes/v1/versions.js, line 37 at r1 (raw file):

Previously, yehiyam wrote…

Is this route used to delete version or algorithm?

version


core/api-server/lib/service/algorithms.js, line 35 at r1 (raw file):

Previously, yehiyam wrote…
algorithmVersion

should be algorithmVersions

Done.


core/api-server/lib/service/algorithms.js, line 278 at r1 (raw file):

Previously, yehiyam wrote…
algorithm.options.debug

I don't think we need a version for debug.

Done.


core/api-server/lib/service/algorithms.js, line 278 at r1 (raw file):

Previously, yehiyam wrote…
!buildId

why not when there is a build? the version is created after the build is done?

Yes


core/api-server/lib/service/builds.js, line 183 at r1 (raw file):

Previously, yehiyam wrote…

maybe add baseImage also?

Done.


core/api-server/tests/algorithms-store.js, line 1692 at r1 (raw file):

Previously, yehiyam wrote…

why do you need sort? versions are not returned in the order they were created?

Yes, but desc... Done


core/api-server/tests/versions.js, line 295 at r1 (raw file):

Previously, yehiyam wrote…

should add tests to delete tags and to change tags

Done.

Copy link
Contributor

@yehiyam yehiyam left a comment

Choose a reason for hiding this comment

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

Reviewed 26 of 26 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @nassiharel)


core/api-server/api/rest-api/swagger/definitions/algorithmApplyOptions.yaml, line 5 at r2 (raw file):

should replace the current image with this image

should set the newly created version as current


core/api-server/lib/service/versions.js, line 86 at r2 (raw file):

versions && versions[0] && versions[0].version

versions?.[0]?.versions

Copy link
Contributor Author

@nassiharel nassiharel left a comment

Choose a reason for hiding this comment

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

Reviewable status: 32 of 37 files reviewed, 2 unresolved discussions (waiting on @yehiyam)


core/api-server/api/rest-api/swagger/definitions/algorithmApplyOptions.yaml, line 5 at r2 (raw file):

Previously, yehiyam wrote…
should replace the current image with this image

should set the newly created version as current

Done.


core/api-server/lib/service/versions.js, line 86 at r2 (raw file):

Previously, yehiyam wrote…
versions && versions[0] && versions[0].version

versions?.[0]?.versions

Done.

@nassiharel
Copy link
Contributor Author

/deploy

@hkube-ci hkube-ci temporarily deployed to dev October 27, 2020 07:48 Inactive
@nassiharel nassiharel requested a review from yehiyam October 27, 2020 07:51
@yehiyam
Copy link
Contributor

yehiyam commented Oct 27, 2020

/deploy

@hkube-ci hkube-ci temporarily deployed to dev October 27, 2020 10:19 Inactive
@nassiharel
Copy link
Contributor Author

/deploy

@hkube-ci hkube-ci temporarily deployed to dev October 27, 2020 10:53 Inactive
@yehiyam
Copy link
Contributor

yehiyam commented Oct 27, 2020

/deploy

@hkube-ci hkube-ci temporarily deployed to dev October 27, 2020 12:49 Inactive
Copy link
Contributor

@yehiyam yehiyam left a comment

Choose a reason for hiding this comment

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

Reviewed 6 of 7 files at r3, 2 of 2 files at r4.
Reviewable status: 38 of 39 files reviewed, all discussions resolved (waiting on @yehiyam)

yehiyam
yehiyam previously approved these changes Oct 27, 2020
Copy link
Contributor

@yehiyam yehiyam left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 7 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Contributor

@yehiyam yehiyam left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 4 files at r5.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @nassiharel)


core/api-server/lib/service/versions.js, line 98 at r5 (raw file):

        try {
            semver = await this._lockSemver(name, semver);

what happens if not successful 3 times?


core/api-server/lib/service/versions.js, line 118 at r5 (raw file):

    }

    async _lockSemver(name, semver) {

perhaps put this method in stateManager?

Copy link
Contributor Author

@nassiharel nassiharel left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @yehiyam)


core/api-server/lib/service/versions.js, line 98 at r5 (raw file):

Previously, yehiyam wrote…

what happens if not successful 3 times?

It gets the latest incremented semver.
If you will run the test should create multiple versions in concurrent mode you will see that happens.
The test simulate 4 parallel requests, and gets ['1.0.3', '1.0.2', '1.0.1', '1.0.0']
If I will run 5 parallel requests I will get ['1.0.3', '1.0.3', '1.0.2', '1.0.1', '1.0.0'] which is not so good.

So I can change it to max 5 attempts, anyway, we have a rate-limiter of 5 requests...


core/api-server/lib/service/versions.js, line 118 at r5 (raw file):

Previously, yehiyam wrote…

perhaps put this method in stateManager?

This method call inside to _incSemver(); (I can use cb)
But anyway this is a specific logic to versions.

Copy link
Contributor Author

@nassiharel nassiharel left a comment

Choose a reason for hiding this comment

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

Reviewable status: 36 of 38 files reviewed, 2 unresolved discussions (waiting on @yehiyam)


core/api-server/lib/service/versions.js, line 98 at r5 (raw file):

Previously, NassiHarel (Nassi Harel) wrote…

It gets the latest incremented semver.
If you will run the test should create multiple versions in concurrent mode you will see that happens.
The test simulate 4 parallel requests, and gets ['1.0.3', '1.0.2', '1.0.1', '1.0.0']
If I will run 5 parallel requests I will get ['1.0.3', '1.0.3', '1.0.2', '1.0.1', '1.0.0'] which is not so good.

So I can change it to max 5 attempts, anyway, we have a rate-limiter of 5 requests...

Done.


core/api-server/lib/service/versions.js, line 118 at r5 (raw file):

Previously, NassiHarel (Nassi Harel) wrote…

This method call inside to _incSemver(); (I can use cb)
But anyway this is a specific logic to versions.

Done.

Copy link
Contributor

@yehiyam yehiyam left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r6.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@nassiharel nassiharel merged commit 698bfe3 into master Oct 28, 2020
@nassiharel nassiharel deleted the algorithm_versions branch October 28, 2020 12:27
@nassiharel nassiharel linked an issue Oct 28, 2020 that may be closed by this pull request
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve algorithms versions
3 participants