-
Notifications
You must be signed in to change notification settings - Fork 788
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
Migrate core logic of importchannel to a utility function and update associated tasks #13099
Migrate core logic of importchannel to a utility function and update associated tasks #13099
Conversation
@@ -587,15 +581,11 @@ def diskimport( | |||
drive = get_mounted_drive_by_id(drive_id) |
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.
This line is duplicated at line 594. Is it a bug or is there any purpose for this?
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.
I don't think it's a bug, but it definitely looks unnecessary the second time. Probably just copy pasted from somewhere else.
logger = logging.getLogger(__name__) | ||
|
||
|
||
def start_file_transfer(job, filetransfer, channel_id, dest, no_upgrade, contentfolder): |
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.
For both of these functions, I would like it if we did not pass in job
as a first argument, and instead invoked get_current_job
inside the function itself.
What you would then need is a dummy job in the case where the function is not running in a task runner context, that just does a noop for all the methods of the job class (this way you don't need to keep on checking if the job exists or not).
This makes sense so far, I'd want the test updated, and not just skipped, before we merge, and I think not passing in the job into the functions is preferable - because that will eventually allow us to phase out the AsyncCommand class (passing the |
Thank you @rtibbles . I will update it by tomorrow:) |
Build Artifacts
|
Updated the utils functions as well as importchannel tests |
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.
This is looking really excellent - great work on this. I'll ask our QA team to confirm the workflows are still working as expected, and we should be ready to merge!
@pcenov @radinamatic we would need to test reviewing a new channel listing from Studio, from disk, and also bulk importing a channel all at once, without viewing the listing. |
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.
Ah, yes, you would need to update the methods to those on the job object, not how they are proxied via the mixin. Sorry, I should probably have caught this sooner! |
logger = logging.getLogger(__name__) | ||
|
||
|
||
class JobProgress(JobProgressMixin): |
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.
Introducing a adapter class is fine? Or will there be problems now or in the future?
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.
I would prefer to migrate to directly accessing the job object rather than continuing the indirection.
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.
Most of the methods are just very thin wrappers around job object methods, so it would be better to remove the extra layer.
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.
re-defining those methods inside this JobProgress would work so?
9fde1c8
to
4e7ce07
Compare
Should work now! |
Hi @thesujai and @rtibbles - I confirm that now all of the import scenarios are functioning correctly. @rtibbles while regression testing I noticed that for some reason only on my Windows 11 laptop the export to USB is not working (works fine on a Windows 10 laptop). Could you take a look at the logs to see whether the error is indicating whether this is something device specific or it's something else: win11-logs.zip |
Hi @pcenov looking at the logs, I do see an error, definitely nothing to do with the changes here, but it looks like the command we are trying to run to get the disk data from Windows is failing for Windows 11! |
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.
Excellent work - code looks good, and QA passes!
QA now confirmed as working! Reported issue unrelated to this PR, filed separately.
Thank you @thesujai for your diligence, hard work, flexibility and good communication to get this wrapped up swiftly! |
Summary
This refactors the importchannel command and its related tasks
References
Fixes #13095
Subtask of #9266
Reviewer guidance
NA