Skip to content

Commit f7fc8c6

Browse files
authored
Merge pull request #183 from valory-xyz/fix/start-button-grayed-out
pause all service on startup
2 parents 49b034e + d46d371 commit f7fc8c6

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

electron/install.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const { BrewScript } = require('./scripts');
1616
* - use "" (nothing as a suffix) for latest release candidate, for example "0.1.0rc26"
1717
* - use "alpha" for alpha release, for example "0.1.0rc26-alpha"
1818
*/
19-
const OlasMiddlewareVersion = '0.1.0rc47';
19+
const OlasMiddlewareVersion = '0.1.0rc50';
2020
const OperateDirectory = `${os.homedir()}/.operate`;
2121
const VenvDir = `${OperateDirectory}/venv`;
2222
const TempDir = `${OperateDirectory}/temp`;

operate/cli.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
from operate.account.user import UserAccount
4343
from operate.constants import KEY, KEYS, OPERATE, SERVICES
4444
from operate.ledger import get_ledger_type_from_chain_type
45-
from operate.types import ChainType
45+
from operate.types import ChainType, DeploymentStatus
4646
from operate.wallet.master import MasterWalletManager
4747

4848

@@ -179,6 +179,25 @@ def cancel_funding_job(service: str) -> None:
179179
if not status:
180180
logger.info(f"Funding job cancellation for {service} failed")
181181

182+
def pause_all_services_on_startup():
183+
logger.info(f"stopping services on startup")
184+
services = [i["hash"] for i in operate.service_manager().json]
185+
186+
for service in services:
187+
if not operate.service_manager().exists(service=service):
188+
continue
189+
deployment = operate.service_manager().create_or_load(service).deployment
190+
if deployment.status == DeploymentStatus.DELETED:
191+
continue
192+
logger.info(f"stopping service {service}")
193+
deployment.stop(force=True)
194+
logger.info(f"Cancelling funding job for {service}")
195+
cancel_funding_job(service=service)
196+
logger.info(f"stopping services on startup: done")
197+
198+
# on backend app started we assume there are now started agents, so we force to pause all
199+
pause_all_services_on_startup()
200+
182201
app = FastAPI()
183202

184203
app.add_middleware(

operate/services/service.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -822,9 +822,9 @@ def start(self, use_docker: bool = False) -> None:
822822
self.status = DeploymentStatus.DEPLOYED
823823
self.store()
824824

825-
def stop(self, use_docker: bool = False) -> None:
825+
def stop(self, use_docker: bool = False, force: bool=False) -> None:
826826
"""Stop the deployment."""
827-
if self.status != DeploymentStatus.DEPLOYED:
827+
if self.status != DeploymentStatus.DEPLOYED and not force:
828828
return
829829

830830
self.status = DeploymentStatus.STOPPING

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"main": "electron/main.js",
44
"name": "olas-operate-app",
55
"productName": "Pearl",
6-
"version": "0.1.0-rc47",
6+
"version": "0.1.0-rc50",
77
"dependencies": {
88
"@ant-design/cssinjs": "^1.18.4",
99
"@ant-design/icons": "^5.3.0",

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "olas-operate-middleware"
3-
version = "0.1.0-rc47"
3+
version = "0.1.0-rc50"
44
description = ""
55
authors = ["David Vilela <[email protected]>", "Viraj Patel <[email protected]>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)