-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Progress bar in the status message modal + auto-refresh of the modal #2108
Changes from 5 commits
33a72d7
66c8223
73b10a6
d9017fe
c7239d8
20ba9a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright 2012-2015 Spotify AB | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
from helpers import LuigiTestCase | ||
|
||
import luigi | ||
import luigi.scheduler | ||
import luigi.worker | ||
|
||
luigi.notifications.DEBUG = True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @Tarrasch, yes we're using it in production for a while and it's pretty smooth. |
||
|
||
|
||
class TaskProgressPercentageTest(LuigiTestCase): | ||
|
||
def test_run(self): | ||
percentage = 30 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think avoiding a variable makes it more readable. :) |
||
sch = luigi.scheduler.Scheduler() | ||
with luigi.worker.Worker(scheduler=sch) as w: | ||
class MyTask(luigi.Task): | ||
def run(self): | ||
self.set_progress_percentage(percentage) | ||
|
||
task = MyTask() | ||
w.add(task) | ||
w.run() | ||
|
||
self.assertEqual(sch.get_task_progress_percentage(task.task_id)["progressPercentage"], percentage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait a second. Why don't we return
None
/{}
here or some sort of failure indication, since the task id didn't exist right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes right, I tried to stick to what was already in place in
get_task_status_message
orfetch_error
.I guess the case may happen if a RPC request is still coming on a given
taskId
while a task is dead (finished a long time ago but browser still opened in the progress bar display).In this case
luigi/static/visualiser/js/visualiserApp.js
should handle it gracefully (hiding the no longer relevant HTML objects).