public ResourcesCounter(Offer offer) { var cpusResource = offer.resources.SingleOrDefault(x => x.name == "cpus"); var memResource = offer.resources.SingleOrDefault(x => x.name == "mem"); _cpus = cpusResource?.scalar.value ?? 0d; _mem = memResource?.scalar.value ?? 0d; }
private TaskInfo GetRenderTaskInfo(Offer offer, int uniqueId, string url) { var result = new TaskInfo { name = "Rendler.Render_" + uniqueId, task_id = new TaskID { value = uniqueId.ToString () }, slave_id = offer.slave_id, resources = { new Resource { name = "cpus", type = Value.Type.SCALAR, scalar = new Value.Scalar { value = RenderCpus } }, new Resource { name = "mem", type = Value.Type.SCALAR, scalar = new Value.Scalar { value = RenderMem } } }, executor = new ExecutorInfo { executor_id = new ExecutorID { value = "RenderExecutor" }, command = new CommandInfo { value = "mono rendler.exe -executor=render", user = _runAsUser }, data = Encoding.UTF8.GetBytes (_outputDir) }, data = Encoding.UTF8.GetBytes (url) }; result.executor.command.uris.Add (new CommandInfo.URI { cache = false, extract = true, value = "./rendler.tar.gz", // relative to "frameworks_home" mesos-slave command argument executable = false }); return result; }