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

Fix/local runtime #61

Merged
merged 3 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
"./runtime_local/src/runtime-up.py"
]
},
{
"id": "down",
"executable": "python3",
"args": [
"./runtime_local/src/runtime-down.py"
]
},
{
"id": "install-deps",
"executable": "python3",
Expand Down
2 changes: 1 addition & 1 deletion runtime_kanto/src/runtime/runtime_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


def runtime_up():
"""Start up the K3D runtime."""
"""Start up the Kanto runtime."""

print("Hint: Log files can be found in your workspace's logs directory")
log_output = create_log_file("runtime-up", "runtime_kanto")
Expand Down
40 changes: 40 additions & 0 deletions runtime_local/src/runtime-down.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

from local_lib import stop_service
from velocitas_lib.services import get_services
from yaspin import yaspin


def runtime_down():
"""Stop the local runtime."""

print("Hint: Log files can be found in your workspace's logs directory")
with yaspin(text="Stopping local runtime...", color="cyan") as spinner:
for service in get_services():
try:
spinner.text = f"Stopping {service.id}..."
stop_service(service)
spinner.write(f"> {service.id} stopped")
except Exception as error:
spinner.write(error.args)
spinner.fail("💥")
print(f"Stopping {service.id} failed")

spinner.text = "Stopped local runtime!"
spinner.ok("✅")


if __name__ == "__main__":
runtime_down()
2 changes: 1 addition & 1 deletion runtime_local/src/runtime-up.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def run_services() -> None:
spinner.write(error.args)
spinner.fail("💥")
terminate_spawned_processes()
print(f"Starting {service.id=} failed")
print(f"Starting {service.id} failed")
with open(
get_log_file_name(service.id, "runtime_local"),
mode="r",
Expand Down
Loading