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

Automate show archive process #1362

Open
DiegoTavares opened this issue May 23, 2024 · 2 comments
Open

Automate show archive process #1362

DiegoTavares opened this issue May 23, 2024 · 2 comments
Assignees
Labels
feature request New feature good first issue Good for newcomers

Comments

@DiegoTavares
Copy link
Collaborator

Feature request

Add a new methods to the show api wrapper to allow archiving a show that has been inactive for a while.

Example of the usage:

from opencue import api

shows = api.findShow("wam")
if shows:
  show = shows[0]
  show.archive()

Context

Archiving a show is useful because it enables jobs to be submitted to the archived show to be executed by allocations subscribed to the show it has been alias to. For example, if a facility has a show called ABC that has wrapped, but its content might still be useful for training purposes, a show calls TRN (training) could be created with small group of hosts assigned to it and ABC could be aliased to TRN which would make jobs submitted to ABC to be picked up by hosts assigned to TRN.

Mechanism

Shows can already be aliased on the database, the current process requires going to the database and adding an entry with the aliased show to the show_alias table and renaming the existing show on the show table to append .archived.
Ideally this should be a hidden feature on the API.

The implementation involves adding a new api call to the proto layer, implementing the client call on pycue and the server logic on cuebot.

To help with the development of this feature, here's a database function that can be triggered to archive a show on demand.

CREATE OR REPLACE FUNCTION archive_show_to_trn(IN SHOW_STR_NAME VARCHAR)
RETURNS VOID AS $body$
BEGIN
    INSERT into show_alias (pk_show_alias, pk_show, str_name)
        SELECT s.pk_show, '00000000-0000-0000-0000-000000000221', s.str_name
            from show s
            where s.str_name = SHOW_STR_NAME;
    UPDATE show set str_name = CONCAT(SHOW_STR_NAME, '_archive') where str_name = SHOW_STR_NAME;
END;
$body$
LANGUAGE PLPGSQL;

-- 00000000-0000-0000-0000-000000000221 is the PK for the show to be used as the destination of the alias
@DiegoTavares DiegoTavares added feature request New feature good first issue Good for newcomers labels May 23, 2024
@DiegoTavares
Copy link
Collaborator Author

FYI @n-jay this is a good first issue to get involved on pycue and cuebot while also touching the database

@n-jay
Copy link
Contributor

n-jay commented May 24, 2024

Ack @DiegoTavares, thanks! Will check this out. Also, could I be assigned to this?
I'll start working on it on the side and get in fully once the addon CI work is at a satisfactory level.

Will send any questions/doubts in a new mail thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants