release¶
Module for releasing workfiles.
The release process in general works like this:
- Open the work file and run sanity checks
- Copy the file to release location and create db entry
- Open the release file and perform cleanup actions
Step 2. is the same for every file. Only 1. and 3. vary
- class jukeboxcore.release.Release(taskfileinfo, checks, cleanup, comment)[source]¶
Bases: object
Handle file releases of taskfiles
Create a release object that can handle the release of the given taskfileinfo
Parameters: - taskfileinfo (TaskFileInfo) – the taskfileinfo for the file that should be released
- checks (ActionCollection) – the action collection object that holds the checks to perform. It should accept a JB_File as object for execute.
- cleanup (ActionCollection) – The action collection object that holds actions to perform on the released file. It should accept a JB_File as object for execute.
- comment – The comment for the release
Raises: None
- release()[source]¶
Create a release
- Perform Sanity checks on work file.
- Copy work file to releasefile location.
- Perform cleanup actions on releasefile.
Returns: True if successfull, False if not. Return type: bool Raises: None
- build_actions()[source]¶
Create an ActionCollection that will perform sanity checks, copy the file, create a database entry and perform cleanup actions and in case of a failure clean everything up.
Parameters: - work (JB_File) – the workfile
- release (JB_File) – the releasefile
- checks (ActionCollection) – the action collection object with sanity checks It should accept a JB_File as object for execute.
- cleanup (ActionCollection) – a action collection object that holds cleanup actions for the given file. It should accept a JB_File as object for execute.
- comment (str) – comment for the release
Returns: An ActionCollection ready to execute.
Return type: ActionCollection
Raises: None
- sanity_check(release)[source]¶
Perform sanity checks on the workfile of the given release
This is inteded to be used in a action unit.
Parameters: release (Release) – the release with the workfile and sanity checks Returns: the action status of the sanity checks Return type: ActionStatus Raises: None
- copy(release)[source]¶
Copy the workfile of the given release to the releasefile location
This is inteded to be used in a action unit.
Parameters: release (Release) – the release with the release and workfile Returns: an action status Return type: ActionStatus Raises: None
- create_db_entry(release)[source]¶
Create a db entry for releasefile of the given release
Set _releasedbentry and _commentdbentry of the given release file
This is inteded to be used in a action unit.
Parameters: release (Release) – the release with the releasefile and comment Returns: an action status Return type: ActionStatus Raises: ValidationError, If the comment could not be created, the TaskFile is deleted and the Exception is propagated.
- cleanup(release)[source]¶
Perform cleanup actions on the releasefile of the given release
This is inteded to be used in a action unit.
Parameters: release (Release) – the release with the releasefile and cleanup actions Returns: the action status of the cleanup actions Return type: ActionStatus Raises: None
- class jukeboxcore.release.ReleaseActions(*args, **kwargs)[source]¶
Bases: object
Abstract class that provides sanity checks and cleanups for a release
This class can also offer a widget to a jukeboxcore.gui.widgets.releasewin.ReleaseWin to give the user options. Depending on these options it should return sanity checks and cleanup actions.
Subclass it and implement, ReleaseActions.get_checks() and ReleaseActions.get_cleanups().
Initialize a new releae option widget
Raises: None - get_checks()[source]¶
Get the sanity check actions for a releaes depending on the selected options
Returns: the cleanup actions Return type: jukeboxcore.action.ActionCollection Raises: None
- get_cleanups()[source]¶
Get the cleanup actions for a releaes depending on the selected options
Returns: the cleanup actions Return type: jukeboxcore.action.ActionCollection Raises: None
- option_widget()[source]¶
Return a widget that gives the user options for the release.
Note
The widget might get parented to another window. So create a new ReleaseAction instance for each window.
The cleanups and sanity checks should correspond to the options the user selects in this widget.
Returns: a widget with options for the user Return type: PySide.QtGui.QWidget | None Raises: None
- jukeboxcore.release.execute_actioncollection(obj, actioncollection, confirm=True)[source]¶
Execute the given actioncollection with the given object
Parameters: - obj – the object to be processed
- actioncollection (ActionCollection) –
- confirm (bool) – If True, ask the user to continue, if actions failed.
Returns: An action status. If the execution fails but the user confirms, the status will be successful.
Return type: ActionStatus
Raises: None