-
Notifications
You must be signed in to change notification settings - Fork 54
fix task and view sync might be buggy #1362
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
Conversation
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
3316490 to
23fff15
Compare
|
rebased to |
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
| return self.none() | ||
|
|
||
| # projects that have an unavailable catalog should be disregarded | ||
| qs = self.filter(catalog__available=True) |
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 maybe still needs a design decision.
Currently, when a project has a catalog that is unavailable it will be disregarded for syncing.
Is this a typical use-case or does the sync needs to go over all applicable projects anyway? @m6121
jochenklar
left a comment
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.
Ok, testes with a lot of projects. And also with the feature disabled. Great work!
rdmo/projects/handlers/sync_utils.py
Outdated
| ) | ||
| return | ||
|
|
||
| for project in to_remove: |
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.
Instead of the loop you can just use instance.projects.remove(*to_remove) here.
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
jochenklar
left a comment
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.
Forget the two last messages. I think you can merge now.
|
I forgot to add the management script to initialize the synced state with, maybe with a for loop over the views/tasks? |
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
jochenklar
left a comment
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.
Again awesome work! I wonder why you use self.stdout.write instread of print?.
| if show: | ||
| self.show_project_tasks_and_views() | ||
| else: | ||
| raise CommandError('You must specify at least one of --tasks or --views') |
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 should include --show.
| task_ids = sorted(project.tasks.values_list('id', flat=True)) | ||
| view_ids = sorted(project.views.values_list('id', flat=True)) | ||
|
|
||
| self.stdout.write(f'Project(id={project.id}) {project.title}:') |
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 format it a bit different:
Project "Test" [id=1]:
- Tasks:
- http://example.com/terms/tasks/null
- http://example.com/terms/tasks/text_equal_test
- Views:
- http://example.com/terms/views/view_a
with
self.stdout.write(f'Project "{project.title}" [id={project.id}]:')
if view_uris:
self.stdout.write('- Tasks:')
for task_uri in task_uris:
self.stdout.write(f' - {task_uri}')
if view_uris:
self.stdout.write('- Views:')
for view_uri in view_uris:
self.stdout.write(f' - {view_uri}')
self.stdout.write()What do you think?
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, with the uris may be better, Ive changed the show method and also adjusted the tests.
I think that the self.stdout.write is better for test-ability with the fixture capsys.readouterr().
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 ok, but I think they are just the same. see https://docs.pytest.org/en/stable/how-to/capture-stdout-stderr.html#accessing-captured-output-from-a-test-function. No problem here though, just merge.
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Description
Related issue: #1360
The incremental signal handling left out some behavior for specific cases in the the synchronization of the projects views or tasks.
For example, when the last catalog of a view is removed it should be available to all catalogs (-> needs to be added to all projects). When a catalog is then added to same view (to an empty views.catalogs), it needs to be added to projects with that catalog and potential removed from other projects.
Now, the architecture has been changed into checking the whole state for all projects on each signal. The incremental design got more complex and need many specific queries.
Test cases were added that explicitly test for the proper behavior.
implementation and tests for
catalogsview.catalogstask.catalogsimplementation and tests for
groupsview.groupstask.groupsimplementation and tests for
sitesview.sitestask.sitesimplementation and tests for
view.availableimplementation and tests for
task.availablehandle sync
viewswhenproject.catalogchangeshandle sync
taskswhenproject.catalogchangesmanagement script
sync_projectsviewson all projectstaskson all projectsPS
I tried out the copilot agent from the codespaces for this (but first suggestion was already a hallucination)