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: algorithm-queue scale #1318

Merged
merged 3 commits into from
Jul 6, 2021
Merged

feat: algorithm-queue scale #1318

merged 3 commits into from
Jul 6, 2021

Conversation

nassiharel
Copy link
Contributor

@nassiharel nassiharel commented Jul 5, 2021

This change is Reviewable

@nassiharel nassiharel requested a review from yehiyam July 5, 2021 14:11
@nassiharel nassiharel linked an issue Jul 5, 2021 that may be closed by this pull request
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 11 of 11 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @nassiharel)


core/algorithm-queue/lib/queues-manager.js, line 77 at r1 (raw file):

    async _checkIdleAlgorithms() {
        const queues = Array.from(this._queues.values());
        const isIdle = queues.filter(q => q.isIdle());

You first check this._isIdle and only after you call checkIdle?


core/algorithm-queue/lib/queues-manager.js, line 79 at r1 (raw file):

        const isIdle = queues.filter(q => q.isIdle());
        const isStaled = queues.filter(q => q.isStaled());
        await Promise.all(queues.map(a => a.checkIdle()));

why do you call checkIdle here?


core/algorithm-queue/lib/queues-manager.js, line 81 at r1 (raw file):

        await Promise.all(queues.map(a => a.checkIdle()));
        await Promise.all(isIdle.map(q => q.pause()));
        await Promise.all(isStaled.map(async q => {

you can call Promise.allSettled and map the results with the error


core/algorithm-queue/lib/jobs/consumer.js, line 42 at r1 (raw file):

    }

    async pause() {

no resume?

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, 4 unresolved discussions (waiting on @nassiharel and @yehiyam)


core/algorithm-queue/lib/queues-manager.js, line 77 at r1 (raw file):

Previously, yehiyam wrote…

You first check this._isIdle and only after you call checkIdle?

If the checkIdle set to true, the _isIdle will be relevant in the next tick (5 sec).


core/algorithm-queue/lib/queues-manager.js, line 81 at r1 (raw file):

Previously, yehiyam wrote…

you can call Promise.allSettled and map the results with the error

This is not much cleaner in this case

const all = await Promise.allSettled(isStaled.map(async q => this._removeAction(q.algorithmName, 'idle', false)));
const rejected = all.filter(a => a.status === 'rejected');
if (rejected.length) {
      rejected.forEach(r => {
          log.throttle.error(`error removing idle queue ${q.algorithmName} ${e.message}`, { component }, e);
          });
}

core/algorithm-queue/lib/jobs/consumer.js, line 42 at r1 (raw file):

Previously, yehiyam wrote…

no resume?

Once it paused it means it was idle & empty for a long time, so in this case, I want to shut it down anyway.
If there is a demand for that algorithm it will be up again.

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:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @nassiharel)

@nassiharel
Copy link
Contributor Author

/deploy

@hkube-ci hkube-ci temporarily deployed to dev July 6, 2021 07:08 Inactive
@nassiharel nassiharel merged commit 7156dc8 into master Jul 6, 2021
@nassiharel nassiharel deleted the algorithm_queue_scale branch July 6, 2021 10:34
hkube-ci pushed a commit that referenced this pull request Jul 6, 2021
* feat: algorithm-queue sclae

* feat: algorithm-queue scaled .... bump version [skip ci]
hkube-ci pushed a commit that referenced this pull request Jul 6, 2021
* feat: algorithm-queue sclae

* feat: algorithm-queue scaled .... bump version [skip ci]
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.

Algorithm Queue auto-removal
3 participants