{"id":19439056,"url":"https://github.com/spacejam/mesos-rs","last_synced_at":"2026-03-02T19:36:56.026Z","repository":{"id":57638113,"uuid":"44982306","full_name":"spacejam/mesos-rs","owner":"spacejam","description":"Mesos bindings using the v1 HTTP API","archived":false,"fork":false,"pushed_at":"2016-01-28T23:58:37.000Z","size":202,"stargazers_count":17,"open_issues_count":4,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-28T10:55:37.669Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spacejam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-26T16:37:29.000Z","updated_at":"2023-05-02T02:33:06.000Z","dependencies_parsed_at":"2022-09-26T20:21:10.630Z","dependency_job_id":null,"html_url":"https://github.com/spacejam/mesos-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/spacejam/mesos-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Fmesos-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Fmesos-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Fmesos-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Fmesos-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacejam","download_url":"https://codeload.github.com/spacejam/mesos-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacejam%2Fmesos-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30016527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T17:00:27.440Z","status":"ssl_error","status_checked_at":"2026-03-02T17:00:03.402Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T15:20:59.706Z","updated_at":"2026-03-02T19:36:55.976Z","avatar_url":"https://github.com/spacejam.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mesos-rs :globe_with_meridians:\n\nSimple bindings for the Mesos v1 HTTP API.  The default trait of SchedulerRouter\nroutes to a traditional mesos callback interface, but you are free to provide your\nown router implementation for working with other coding styles if you prefer.\nFlexibility is the primary concern with this library.\n\nRoadmap:\n- [x] scheduler\n- [ ] executor\n- [ ] zk master detection and failover\n\n#### Running\n```\n[dependencies]\nmesos = \"0.2.10\"\n```\n\n###### Scheduler\n\n```rust\nextern crate mesos;\n\nuse self::mesos::{Scheduler, SchedulerClient, SchedulerConf,\n            ProtobufCallbackRouter, run_protobuf_scheduler};\nuse self::mesos::proto::*;\nuse self::mesos::util;\n\nstruct TestScheduler {\n    max_id: u64,\n}\n\nimpl TestScheduler {\n    fn get_id(\u0026mut self) -\u003e u64 {\n        self.max_id += 1;\n        self.max_id\n    }\n}\n\nimpl Scheduler for TestScheduler {\n    fn subscribed(\u0026mut self,\n                  client: \u0026SchedulerClient,\n                  framework_id: \u0026FrameworkID,\n                  heartbeat_interval_seconds: Option\u003cf64\u003e) {\n        println!(\"received subscribed\");\n\n        client.reconcile(vec![]);\n    }\n\n    // Inverse offers are only available with the HTTP API\n    // and are great for doing things like triggering\n    // replication with stateful services before the agent\n    // goes down for maintenance.\n    fn inverse_offers(\u0026mut self,\n                      client: \u0026SchedulerClient,\n                      inverse_offers: Vec\u003c\u0026InverseOffer\u003e) {\n        println!(\"received inverse offers\");\n\n        // this never lets go willingly\n        let offer_ids = inverse_offers.iter()\n                                      .map(|o| o.get_id().clone())\n                                      .collect();\n        client.decline(offer_ids, None);\n    }\n\n    fn offers(\u0026mut self, client: \u0026SchedulerClient, offers: Vec\u003c\u0026Offer\u003e) {\n\n        // Offers are guaranteed to be for the same agent, and\n        // there will be at least one.\n        let agent_id = offers[0].get_agent_id();\n\n        println!(\"received {} offers from agent {}\",\n                 offers.len(),\n                 agent_id.get_value());\n\n        let offer_ids: Vec\u003cOfferID\u003e = offers.iter()\n                                            .map(|o| o.get_id().clone())\n                                            .collect();\n\n        // get resources with whatever filters you need\n        let mut offer_cpus: f64 = offers.iter()\n                                        .flat_map(|o| o.get_resources())\n                                        .filter(|r| r.get_name() == \"cpus\")\n                                        .map(|c| c.get_scalar())\n                                        .fold(0f64, |acc, cpu_res| {\n                                            acc + cpu_res.get_value()\n                                        });\n\n        // or use this if you don't require special filtering\n        let mut offer_mem = util::get_scalar_resource_sum(\"mem\", offers);\n\n        let mut tasks = vec![];\n        while offer_cpus \u003e= 1f64 \u0026\u0026 offer_mem \u003e= 128f64 {\n            let name = \u0026*format!(\"sleepy-{}\", self.get_id());\n\n            let task_id = util::task_id(name);\n\n            let mut command = CommandInfo::new();\n            command.set_value(\"env \u0026\u0026 sleep 10\".to_string());\n\n            let mem = util::scalar(\"mem\", \"*\", 128f64);\n            let cpus = util::scalar(\"cpus\", \"*\", 1f64);\n\n            let resources = vec![mem, cpus];\n\n            let task_info = util::task_info(name,\n                                            \u0026task_id,\n                                            agent_id,\n                                            \u0026command,\n                                            resources);\n            tasks.push(task_info);\n            offer_cpus -= 1f64;\n            offer_mem -= 128f64;\n        }\n        client.launch(offer_ids, tasks, None);\n    }\n\n    fn rescind(\u0026mut self, client: \u0026SchedulerClient, offer_id: \u0026OfferID) {\n        println!(\"received rescind\");\n    }\n\n    fn update(\u0026mut self, client: \u0026SchedulerClient, status: \u0026TaskStatus) {\n        println!(\"received update {:?} from {}\",\n                 status.get_state(),\n                 status.get_task_id().get_value());\n    }\n\n    fn message(\u0026mut self,\n               client: \u0026SchedulerClient,\n               agent_id: \u0026AgentID,\n               executor_id: \u0026ExecutorID,\n               data: Vec\u003cu8\u003e) {\n        println!(\"received message\");\n    }\n\n    fn failure(\u0026mut self,\n               client: \u0026SchedulerClient,\n               agent_id: Option\u003c\u0026AgentID\u003e,\n               executor_id: Option\u003c\u0026ExecutorID\u003e,\n               status: Option\u003ci32\u003e) {\n        println!(\"received failure\");\n    }\n\n    fn error(\u0026mut self, client: \u0026SchedulerClient, message: String) {\n        println!(\"received error\");\n    }\n\n    fn heartbeat(\u0026mut self, client: \u0026SchedulerClient) {\n        println!(\"received heartbeat\");\n    }\n\n    fn disconnected(\u0026mut self) {\n        println!(\"disconnected from scheduler\");\n    }\n}\n\nfn main() {\n    let mut scheduler = TestScheduler { max_id: 0 };\n\n    let conf = SchedulerConf {\n        master_url: \"http://localhost:5050\".to_string(),\n        user: \"root\".to_string(),\n        name: \"rust http\".to_string(),\n        framework_timeout: 0f64,\n        implicit_acknowledgements: true,\n        framework_id: None,\n    };\n\n    // If you don't like the callback approach, you can implement\n    // an event router of your own.  This is merely provided for\n    // those familiar with the mesos libraries in other languages.\n    let mut router = ProtobufCallbackRouter {\n        scheduler: \u0026mut scheduler,\n        conf: conf.clone(),\n    };\n\n    run_protobuf_scheduler(\u0026mut router, conf)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacejam%2Fmesos-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacejam%2Fmesos-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacejam%2Fmesos-rs/lists"}