diff options
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/TextToImage/IManager.php | 11 | ||||
-rw-r--r-- | lib/public/TextToImage/IProvider.php | 6 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/public/TextToImage/IManager.php b/lib/public/TextToImage/IManager.php index c5c8a0a22a6..cd97312779c 100644 --- a/lib/public/TextToImage/IManager.php +++ b/lib/public/TextToImage/IManager.php @@ -26,6 +26,7 @@ declare(strict_types=1); namespace OCP\TextToImage; +use OCP\DB\Exception; use OCP\PreConditionNotMetException; use OCP\TextToImage\Exception\TaskNotFoundException; use RuntimeException; @@ -55,12 +56,20 @@ interface IManager { * If inference fails a \OCP\TextToImage\Events\TaskFailedEvent will be dispatched instead * * @param Task $task The task to schedule - * @throws PreConditionNotMetException If no or not the requested provider was registered but this method was still called + * @throws PreConditionNotMetException If no provider was registered but this method was still called + * @throws Exception If there was a problem inserting the task into the database * @since 28.0.0 */ public function scheduleTask(Task $task) : void; /** + * @throws Exception if there was a problem inserting the task into the database + * @throws PreConditionNotMetException if no provider is registered + * @throws RuntimeException If the task run fail + */ + public function runOrScheduleTask(Task $task) : void; + + /** * Delete a task that has been scheduled before * * @param Task $task The task to delete diff --git a/lib/public/TextToImage/IProvider.php b/lib/public/TextToImage/IProvider.php index 4fc73089243..12cf39bb713 100644 --- a/lib/public/TextToImage/IProvider.php +++ b/lib/public/TextToImage/IProvider.php @@ -49,4 +49,10 @@ interface IProvider { * @throws RuntimeException If the text could not be processed */ public function generate(string $prompt, $resource): void; + + /** + * The expected runtime for one task with this provider in seconds + * @since 28.0.0 + */ + public function getExpectedRuntime(): int; } |