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

Update UI to indicate when a plugin attached to an entrypoint is out-of-date and provide a mechanism to sync to the latest version of plugins. #678

Open
wants to merge 22 commits into
base: dev
Choose a base branch
from

Conversation

keithmanville
Copy link
Collaborator

@keithmanville keithmanville commented Nov 8, 2024

We want the UI to indicate when a plugin attached to an entrypoint is out-of-date and provide a mechanism to sync to the latest version of plugins.

This update takes the entry_point_plugin_files table and splits it down into 2 separate linking tables, plugin_plugin_files and entry_point_plugins. This change allows us to treat the plugin files as entirely coupled to the plugins namespace as a container, instead of their snapshotted history being tied to updates in the entrypoint.

In the entrypoint table and edit form, plugins should be labeled as outdated if it isn't the latestSnapshot. Beside each outdated plugin should be a "sync to latest plugin" button that should update the plugin to the latest snapshot. This is available in the entrypoint edit form and the assign plugins dialog in the entrypoints table.

@keithmanville keithmanville linked an issue Nov 8, 2024 that may be closed by this pull request
16 tasks
@keithmanville keithmanville marked this pull request as ready for review December 5, 2024 18:05
@keithmanville keithmanville self-assigned this Dec 5, 2024
src/dioptra/restapi/db/models/plugins.py Outdated Show resolved Hide resolved
src/dioptra/restapi/v1/entrypoints/service.py Outdated Show resolved Hide resolved
src/dioptra/restapi/v1/plugins/schema.py Show resolved Hide resolved
src/dioptra/restapi/v1/entrypoints/service.py Outdated Show resolved Hide resolved
src/dioptra/restapi/v1/entrypoints/schema.py Outdated Show resolved Hide resolved
src/dioptra/restapi/v1/entrypoints/schema.py Show resolved Hide resolved
src/dioptra/restapi/v1/utils.py Outdated Show resolved Hide resolved
@keithmanville
Copy link
Collaborator Author

made some modifications to use the Plugin -> PluginFiles relationship. This simplifies service layer code and I was able to remove some repeated queries.

@keithmanville keithmanville changed the title feat: split entry_point_plugin_files table into two linking tables We want the UI to indicate when a plugin attached to an entrypoint is out-of-date and provide a mechanism to sync to the latest version of plugins. Dec 13, 2024
@keithmanville keithmanville changed the title We want the UI to indicate when a plugin attached to an entrypoint is out-of-date and provide a mechanism to sync to the latest version of plugins. Update UI to indicate when a plugin attached to an entrypoint is out-of-date and provide a mechanism to sync to the latest version of plugins. Dec 13, 2024
@keithmanville keithmanville force-pushed the plugin-files-as-dependent-children-of-plugins branch from d408837 to cb14c2a Compare December 24, 2024 13:41
plugin = {
entry_point_plugin.plugin.resource_id: entry_point_plugin.plugin
for entry_point_plugin in entrypoint.entry_point_plugins
}.get(plugin_id, None)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternative implementation that doesn't require creating a dictionary in memory with all plugins:

[entry_point_plugin.plugin for entry_point_plugin in entrypoint.entry_point_plugins if plugin_id == entry_point_plugin.plugin.resource_id]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utils.PluginWithFilesDict(
plugin=entry_point_plugin.plugin,
plugin_files=[
plugin_file for plugin_file in entry_point_plugin.plugin.plugin_files
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't need the list comprehension. Can just use plugins_files=entry_point_plugin.plugin.plugin_files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name=plugin.name,
description=plugin.description,
resource=plugin.resource,
creator=current_user,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this a parameter to this helper function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -776,6 +756,8 @@ def create(
new_plugin_file.parents.append(plugin.resource)
db.session.add(new_plugin_file)

_update_plugin_and_file_snapshots(plugin, new_plugin_file)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to review if there's a better way to capture this logic, as written I'm getting confused as to what's happening.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -50,7 +50,7 @@

def export_task_engine_yaml(
entrypoint: models.EntryPoint,
entry_point_plugin_files: list[models.EntryPointPluginFile],
entry_point_plugin_files: list[models.PluginPluginFile],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably rename these now that its just the plugin <-> plugin_file linking

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

models.EntryPointPluginFile.entry_point_resource_snapshot_id
== entry_point_resource_snapshot_id_stmt.scalar_subquery(),

# Get plugins linked to the entry point
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be possible to revise this query in light of the other changes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 410 to 412
"queue_id": queue_snapshot_id,
"experiment_id": experiment_snapshot_id,
"entrypoint_id": entrypoint_snapshot_id,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems incorrect to use a snapshot id instead of a resource id, need to investigate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keithmanville keithmanville force-pushed the plugin-files-as-dependent-children-of-plugins branch from cb14c2a to 99396db Compare January 30, 2025 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update UI to indicate when a plugin attached to an entrypoint is out-of-date
2 participants