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
Replace ProgressBar with ProgressReport #293
Conversation
| @@ -386,17 +386,6 @@ class Migration(migrations.Migration): | |||
| }, | |||
| bases=('core.progressreport',), | |||
| ), | |||
| migrations.CreateModel( | |||
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.
Can we apply this as a new migration instead? That will allow us to keep pre-production upgrades simpler.
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, I will change it
e6d9936
to
ba0b10e
Compare
|
This PR started as a bugfix, but then it transitioned more into doing the work of 5444 which I believe is right because we want to get the big parts right and then handle bugs on them. Can this PR become dedicated to 5444 and not include the bugfix? My concern is that we would be spreading out the 5444 (possible breaking change) across more PRs and time instead of all at once. What do you think? |
ref #5444 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127
ref #5444 https://pulp.plan.io/issues/5444 Required PR: pulp/pulpcore#293 Required PR: pulp/pulp_file#277
ref #5444 https://pulp.plan.io/issues/5444 Required PR: pulp/pulpcore#293 Required PR: pulp/pulp_file#277
ref #5444 https://pulp.plan.io/issues/5444 Required PR: pulp/pulpcore#293 Required PR: pulp/pulp_file#277
ref #5444 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127
CHANGES/5444.misc
Outdated
| @@ -0,0 +1 @@ | |||
| Using `ProgressReport` for known and unknown items count. | |||
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 would be good as a .feature so it can be shown (because of the misc template not being shown).
pulpcore/app/models/progress.py
Outdated
|
|
||
| class Meta: | ||
| proxy = True | ||
|
|
||
| def increment(self): | ||
| """ | ||
| Increment done count and save the progress bar. |
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.
Can progress bar be updated please.
ref #5444 https://pulp.plan.io/issues/5444 Required PR: pulp/pulpcore#293 Required PR: pulp/pulp_file#277
| @@ -31,8 +31,7 @@ class ProgressReport(Model): | |||
| code (models.CharField): identifies the type of progress report | |||
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.
Can L#25 be updated since it's no longer a base model, but to be used directly.
pulpcore/app/models/progress.py
Outdated
| @@ -106,8 +105,8 @@ def __exit__(self, type, value, traceback): | |||
| See the context manager documentation for more info on __exit__ parameters | |||
| """ | |||
| self._using_context_manager = False | |||
| if self.total is None and self.done != 0: | |||
| self.total = self.done | |||
| if self.total is None: | |||
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'm not sure why we have this conditional case. Can we do away with this part?
|
Since we need to redo migrations for this change anyways, I decided to make another small change that would also require redoing the migrations, and we can merge them around the same time to avoid doing it more than once. |
ref #5444 https://pulp.plan.io/issues/5444 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
closes #5477 https://pulp.plan.io/issues/5477 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
closes #5469 https://pulp.plan.io/issues/5469 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
closes #5471 https://pulp.plan.io/issues/5471 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
closes #5470 https://pulp.plan.io/issues/5470 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
ab00f33
to
cd309c3
Compare
ref #5444 https://pulp.plan.io/issues/5444 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
| @@ -20,8 +20,6 @@ | |||
|
|
|||
| class ProgressReport(Model): | |||
| """ | |||
| A base model for all progress reporting. | |||
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 keep that line and just remove the 'base'.
| You can also use this short form which handles all necessary save() calls: | ||
|
|
||
| >>> with ProgressSpinner(message='Publishing Metadata'): | ||
| >>> publish_metadata() |
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.
It's a pity, that we loose all those good code examples.
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 agree and didn't realize that. @fabricio-aguiar can we move these back to the docstrings we are keeping?
| share the same in-memory instance. Django does not synchronize in-memory model instances, so | ||
| multiple instances of a specific ProgressBar will diverge as they are written to from separate | ||
| threads. | ||
| """ |
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 think the documentation should transmogrified into the foremer base model.
Required PR: pulp/pulpcore#293 [noissue]
Required PR: pulp/pulpcore#293 [noissue]
Required PR: pulp/pulpcore#293 [noissue]
closes #5444 https://pulp.plan.io/issues/5444 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
closes #5469 https://pulp.plan.io/issues/5469 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
closes #5471 https://pulp.plan.io/issues/5471 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
closes #5470 https://pulp.plan.io/issues/5470 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
closes #5469 https://pulp.plan.io/issues/5469 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
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 believe all of this is correct.
closes #5470 https://pulp.plan.io/issues/5470 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
closes #5469 https://pulp.plan.io/issues/5469 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
closes #5477 https://pulp.plan.io/issues/5477 Required PR: pulp/pulpcore#293 Required PR: pulp/pulpcore-plugin#127 Required PR: pulp/pulp_file#277
closes #5444
Required PR: pulp/pulpcore-plugin#127
https://pulp.plan.io/issues/5444
Please be sure you have read our documentation on creating PRs:
https://docs.pulpproject.org/en/3.0/nightly/contributing/pull-request-walkthrough.html