Crates.io | ih-muse-proto |
lib.rs | ih-muse-proto |
version | |
source | src |
created_at | 2024-11-20 21:15:44.188546 |
updated_at | 2024-12-12 12:46:33.780301 |
description | Data structures used for communication and handle serialization |
homepage | https://infinitehaiku.com |
repository | https://github.com/infinitehaiku/ih-muse |
max_upload_size | |
id | 1455299 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
IH-Muse is designed for seamless integration with the IH system, providing efficient metrics tracking, element registration, and event recording capabilities in both Python and Rust.
Poet
(real-time interaction) and Mock
(testing).IH-Muse can be installed in Python and configured to work in conjunction with the Muse system. Rust users can include IH-Muse as a dependency in their Cargo project.
Ensure you have maturin
installed for building Rust extensions:
pip install maturin
Clone the repository and install IH-Muse with:
git clone https://github.com/infinitehaiku/ih-muse.git
cd ih-muse
make install
To add IH-Muse to your Rust project, use the following cargo
command:
cargo add ih-muse
This will automatically add the latest version of IH-Muse to your Cargo.toml
dependencies:
[dependencies]
ih-muse = "latest-compatible-version"
Alternatively, you can manually add it to your Cargo.toml
:
[dependencies]
ih-muse = "*"
import asyncio
from ih_muse import Muse, Config, ClientType
from ih_muse.proto import ElementKindRegistration, MetricDefinition, TimestampResolution
async def main():
config = Config(
endpoints=["http://localhost:8080"],
client_type=ClientType.Poet,
default_resolution=TimestampResolution.Milliseconds,
element_kinds=[ElementKindRegistration("kind_code", "description")],
metric_definitions=[MetricDefinition("metric_code", "description")],
max_reg_elem_retries=3,
recording_enabled=False,
)
muse = Muse(config)
await muse.initialize(timeout=5.0)
local_elem_id = await muse.register_element("kind_code", "Element Name", metadata={}, parent_id=None)
await muse.send_metric(local_elem_id, "metric_code", 42.0)
asyncio.run(main())
use ih_muse::prelude::*;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> MuseResult<()> {
let config = Config::new(
vec!["http://localhost:8080".to_string()],
ClientType::Poet,
false,
None,
TimestampResolution::Milliseconds,
vec![ElementKindRegistration::new("kind_code", "description")],
vec![MetricDefinition::new("metric_code", "description")],
Some(std::time::Duration::from_secs(60)),
3,
)?;
let mut muse = Muse::new(&config)?;
muse.initialize(Some(std::time::Duration::from_secs(5))).await?;
let local_elem_id = muse.register_element("kind_code", "Element Name".to_string(), HashMap::new(), None).await?;
muse.send_metric(local_elem_id, "metric_code", MetricValue::from(42.0)).await?;
Ok(())
}
IH-Muse offers a rich set of configuration options to customize its behavior. Below are key parameters you can set:
Poet
(real client) or Mock
(testing).IH-Muse is versatile for various use cases:
Mock
client to simulate system behavior.Contributions are welcome! Please see our CONTRIBUTING.md for guidelines on how to contribute, report issues, and request features.
IH-Muse is licensed under the MIT License.