-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Admin options adjustments (different compute devices support) (#267)
Minor fixes, adjusted Admin settings UI and backend part with optional compute device (NVIDIA/ADM/CPU) daemon configuration. --------- Signed-off-by: Andrey Borysenko <[email protected]>
- Loading branch information
1 parent
5acfac7
commit 9fb115b
Showing
18 changed files
with
321 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ to join us in shaping a more versatile, stable, and secure app landscape. | |
*Your insights, suggestions, and contributions are invaluable to us.* | ||
]]></description> | ||
<version>2.4.0</version> | ||
<version>2.5.0</version> | ||
<licence>agpl</licence> | ||
<author mail="[email protected]" homepage="https://github.com/andrey18106">Andrey Borysenko</author> | ||
<author mail="[email protected]" homepage="https://github.com/bigcat88">Alexander Piskun</author> | ||
|
@@ -72,6 +72,7 @@ to join us in shaping a more versatile, stable, and secure app landscape. | |
<install> | ||
<step>OCA\AppAPI\Migration\DataInitializationStep</step> | ||
<step>OCA\AppAPI\Migration\DaemonUpdateV2RepairStep</step> | ||
<step>OCA\AppAPI\Migration\DaemonUpdateGPUSRepairStep</step> | ||
</install> | ||
</repair-steps> | ||
<commands> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OCA\AppAPI\Migration; | ||
|
||
use OCA\AppAPI\Db\DaemonConfig; | ||
use OCA\AppAPI\Db\DaemonConfigMapper; | ||
use OCP\DB\Exception; | ||
use OCP\Migration\IOutput; | ||
use OCP\Migration\IRepairStep; | ||
use Psr\Log\LoggerInterface; | ||
|
||
class DaemonUpdateGPUSRepairStep implements IRepairStep { | ||
public function __construct( | ||
private readonly DaemonConfigMapper $daemonConfigMapper, | ||
private readonly LoggerInterface $logger, | ||
) { | ||
} | ||
|
||
public function getName(): string { | ||
return 'AppAPI Daemons configuration GPU params update'; | ||
} | ||
|
||
public function run(IOutput $output): void { | ||
$daemons = $this->daemonConfigMapper->findAll(); | ||
$daemonsUpdated = 0; | ||
// Update manual-install daemons | ||
/** @var DaemonConfig $daemon */ | ||
foreach ($daemons as $daemon) { | ||
$daemonsUpdated += $this->updateDaemonConfiguration($daemon); | ||
} | ||
$output->info(sprintf('Daemons configuration GPU params updated: %s', $daemonsUpdated)); | ||
} | ||
|
||
private function updateDaemonConfiguration(DaemonConfig $daemonConfig): int { | ||
$updated = false; | ||
|
||
$deployConfig = $daemonConfig->getDeployConfig(); | ||
if (isset($deployConfig['gpu'])) { | ||
if (filter_var($deployConfig['gpu'], FILTER_VALIDATE_BOOLEAN)) { | ||
$deployConfig['computeDevice'] = [ | ||
'id' => 'cuda', | ||
'label' => 'CUDA (NVIDIA)', | ||
]; | ||
} else { | ||
$deployConfig['computeDevice'] = [ | ||
'id' => 'cpu', | ||
'label' => 'CPU', | ||
]; | ||
} | ||
unset($deployConfig['gpu']); | ||
$daemonConfig->setDeployConfig($deployConfig); | ||
$updated = true; | ||
} | ||
|
||
if ($updated) { | ||
try { | ||
$this->daemonConfigMapper->update($daemonConfig); | ||
return 1; | ||
} catch (Exception $e) { | ||
$this->logger->error( | ||
sprintf('Failed to update Daemon config (%s: %s)', | ||
$daemonConfig->getAcceptsDeployId(), $daemonConfig->getName()), | ||
['exception' => $e] | ||
); | ||
return 0; | ||
} | ||
} | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.