-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vendoring solver-service and delete local solver The solver code has moved to https://github.com/ocurrent/solver-service and can now be run as a cluster job. It's also possible to run the local pipeline with remote solver(cap file) or local solver(spawning a local solver). Co-authored-by: Tim McGilchrist <timmcgil@gmail.com>
- Loading branch information
1 parent
0eeebe1
commit 2b8bc91
Showing
65 changed files
with
226 additions
and
1,057 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
include Schema.MakeRPC (Capnp_rpc_lwt) | ||
module Solve = Solver_service_api.Raw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1 @@ | ||
open Lwt.Infix | ||
open Capnp_rpc_lwt | ||
|
||
module Log = struct | ||
module X = Raw.Client.Log | ||
|
||
type t = X.t Capability.t | ||
|
||
let pp_timestamp f x = | ||
let open Unix in | ||
let tm = gmtime x in | ||
Fmt.pf f "%04d-%02d-%02d %02d:%02d.%02d" (tm.tm_year + 1900) (tm.tm_mon + 1) | ||
tm.tm_mday tm.tm_hour tm.tm_min tm.tm_sec | ||
|
||
let write t msg = | ||
let open X.Write in | ||
let message_size = 150 + String.length msg in | ||
let request, params = | ||
Capability.Request.create ~message_size Params.init_pointer | ||
in | ||
Params.msg_set params msg; | ||
Capability.call_for_unit_exn t method_id request | ||
|
||
let info t fmt = | ||
let now = Unix.gettimeofday () in | ||
let k msg = | ||
let thread = write t msg in | ||
Lwt.on_failure thread (fun ex -> | ||
Format.eprintf "Log.info(%S) failed: %a@." msg Fmt.exn ex) | ||
in | ||
Fmt.kstr k ("%a [INFO] @[" ^^ fmt ^^ "@]@.") pp_timestamp now | ||
end | ||
|
||
module X = Raw.Client.Solver | ||
|
||
type t = X.t Capability.t | ||
|
||
let solve t ~log reqs = | ||
let open X.Solve in | ||
let request, params = Capability.Request.create Params.init_pointer in | ||
Params.request_set params | ||
(Worker.Solve_request.to_yojson reqs |> Yojson.Safe.to_string); | ||
Params.log_set params (Some log); | ||
Capability.call_for_value_exn t method_id request >|= Results.response_get | ||
>|= fun json -> | ||
match Worker.Solve_response.of_yojson (Yojson.Safe.from_string json) with | ||
| Ok x -> x | ||
| Error ex -> failwith ex | ||
include Solver_service_api.Solver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1 @@ | ||
(** Communication between ocaml-ci and the workers. *) | ||
|
||
(** Variables describing a build environment. *) | ||
module Vars = struct | ||
type t = { | ||
arch : string; | ||
os : string; | ||
os_family : string; | ||
os_distribution : string; | ||
os_version : string; | ||
ocaml_package : string; | ||
ocaml_version : string; | ||
opam_version : string; | ||
} | ||
[@@deriving yojson] | ||
end | ||
|
||
(** A set of packages for a single build. *) | ||
module Selection = struct | ||
type t = { | ||
id : string; (** The platform ID from the request. *) | ||
compat_pkgs : string list; | ||
(** Local root packages compatible with the platform. *) | ||
packages : string list; (** The selected packages ("name.version"). *) | ||
commit : string; (** A commit in opam-repository to use. *) | ||
} | ||
[@@deriving yojson, ord] | ||
end | ||
|
||
(** A request to select sets of packages for the builds. *) | ||
module Solve_request = struct | ||
type t = { | ||
opam_repository_commit : string; (** Commit in opam repository to use. *) | ||
root_pkgs : (string * string) list; | ||
(** Name and contents of top-level opam files. *) | ||
pinned_pkgs : (string * string) list; | ||
(** Name and contents of other pinned opam files. *) | ||
platforms : (string * Vars.t) list; (** Possible build platforms, by ID. *) | ||
} | ||
[@@deriving yojson] | ||
end | ||
|
||
(** The response from the solver. *) | ||
module Solve_response = struct | ||
type ('a, 'b) result = ('a, 'b) Stdlib.result = Ok of 'a | Error of 'b | ||
[@@deriving yojson] | ||
|
||
type t = (Selection.t list, [ `Msg of string ]) result [@@deriving yojson] | ||
end | ||
include Solver_service_api.Worker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,5 @@ | |
opam-0install-solver | ||
ocluster | ||
ocaml-version | ||
solver-service | ||
ocaml-dockerfile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.