text stringlengths 12 786k |
|---|
module Make ( Event : Worker_intf . EVENT ) ( Request : Worker_intf . VIEW ) ( Static : STATIC ) : Worker_intf . LOGGER with module Event = Event and module Request = Request = struct module Event = Event module Request = Request type status = | WorkerEvent of ( Event . t * Internal_ev... |
type context = { worker : Worker . t ; timeout : int ; timeout_fn : unit -> unit ; waiting : ( ( Jv . t , exn ) exn Result . t Lwt_mvar . t * int ) int Queue . t ; } |
let demux context msg = Lwt . async ( fun ( ) -> match Queue . take_opt context . waiting with | None -> Lwt . return ( ) | Some ( mv , outstanding_execution ) outstanding_execution -> Brr . G . stop_timer outstanding_execution ; let msg : Jv . t = Message . Ev . data ( Brr . Ev . ... |
let start worker timeout timeout_fn = let context = { worker ; timeout ; timeout_fn ; waiting = Queue . create ( ) } in let ( ) = Brr . Ev . listen Message . Ev . message ( demux context ) context ( Worker . as_target worker ) worker in context |
let rpc context call = let open Lwt in let jv = Conv . jv_of_rpc_call call in let mv = Lwt_mvar . create_empty ( ) in let outstanding_execution = Brr . G . set_timeout ~ ms : 10000 ( fun ( ) -> Lwt . async ( fun ( ) -> Lwt_mvar . put mv ( Error Timeout ) Timeout ) Timeout ; context... |
module Prevalidators = struct module S = struct let list = RPC_service . get_service ~ description " : Lists the Prevalidator workers and their status . " ~ query : RPC_query . empty ~ output : ( list ( obj4 ( req " chain_id " Chain_id . encoding ) ( req " status " ( Worker_type... |
module Block_validator = struct module S = struct let state = RPC_service . get_service ~ description " : Introspect the state of the block_validator worker . " ~ query : RPC_query . empty ~ output : ( Worker_types . full_status_encoding Block_validator_worker_state . Request . encoding RPC_e... |
module Peer_validators = struct module S = struct let list = RPC_service . get_service ~ description " : Lists the peer validator workers and their status . " ~ query : RPC_query . empty ~ output : ( list ( obj4 ( req " peer_id " P2p_peer . Id . encoding ) ( req " status " ( W... |
module Chain_validators = struct module S = struct let list = RPC_service . get_service ~ description " : Lists the chain validator workers and their status . " ~ query : RPC_query . empty ~ output : ( list ( obj4 ( req " chain_id " Chain_id . encoding ) ( req " status " ( Worke... |
module type Base_intf = sig type t type create_args type input type output val create : create_args -> t val close : t -> unit Deferred . t end |
module type Worker_intf = sig include Base_intf val perform : t -> input -> output Deferred . t end |
module type S = sig include Base_intf val is_working : t -> bool val dispatch : t -> input -> output Deferred . t end |
module Make ( Worker : Worker_intf ) Worker_intf : S with type create_args := Worker . create_args and type input := Worker . input and type output := Worker . output = struct type t = { mutable thread : Worker . output Deferred . t option ; worker : Worker . t } let create args = { thread ... |
type worker_status = | Launching of Time . System . t | Running of Time . System . t | Closing of Time . System . t * Time . System . t | Closed of Time . System . t * Time . System . t * error list option |
let worker_status_encoding error_encoding = let open Data_encoding in union [ case ( Tag 0 ) ~ title " : Launching " ( obj2 ( req " phase " ( constant " launching " ) ) ( req " since " Time . System . encoding ) ) ( function Launching t -> Some ( ( ) , t ) | _... |
type worker_information = { instances_number : int ; wstatus : worker_status ; queue_length : int ; } |
let worker_information_encoding error_encoding = Data_encoding . ( conv ( fun { instances_number ; wstatus ; queue_length } -> ( instances_number , wstatus , queue_length ) ) ( fun ( instances_number , wstatus , queue_length ) -> { instances_number ; wstatus ; queue_length } ... |
type request_status = { pushed : Time . System . t ; treated : Time . System . Span . t ; completed : Time . System . Span . t ; } |
let request_status_encoding = let open Data_encoding in conv ( fun { pushed ; treated ; completed } -> ( pushed , treated , completed ) ) ( fun ( pushed , treated , completed ) -> { pushed ; treated ; completed } ) ( obj3 ( req " pushed " Time . System . encoding )... |
type ' req full_status = { status : worker_status ; pending_requests : ( Time . System . t * ' req ) list ; current_request : ( Time . System . t * Time . System . t * ' req ) option ; } |
let full_status_encoding req_encoding error_encoding = let open Data_encoding in let requests_encoding = list ( obj2 ( req " pushed " Time . System . encoding ) ( req " request " ( dynamic_size req_encoding ) ) ) in let current_request_encoding = obj3 ( req " pushed " Time . Syste... |
let pp_status ppf { pushed ; treated ; completed } = Format . fprintf ppf " Request pushed on % a , treated in % a , completed in % a " Time . System . pp_hum pushed Ptime . Span . pp treated Ptime . Span . pp completed |
type path = | FS_path of string | Cache_id of string | Cd of path * string list |
let cd dir sel = match dir with | Cd ( indir , insel ) -> Cd ( indir , insel @ sel ) | FS_path _ | Cache_id _ -> Cd ( dir , sel ) |
module Docker_image = struct type t = { account : string ; name : string ; tag : string option ; registry : string option ; } end |
module Singularity_image = struct type t = { account : string ; name : string ; tag : string option ; registry : string option ; } end |
type container_image = | Docker_image of Docker_image . t | Singularity_image of Singularity_image . t |
let docker_image ? tag ? registry ~ account ~ name ( ) = Docker_image { account = account ; name = name ; tag = tag ; registry = registry ; } |
type _ t = | Pure : { id : string ; value : ' a } -> ' a t | App : { id : string ; f : ( ' a -> ' b ) t ; x : ' a t ; } -> ' b t | Both : { id : string ; fst : ' a t ; snd : ' b t ; } -> ( ' a ' * b ) t | List : { id : string ; elts : ' ... |
let digest x = Digest . to_hex ( Digest . string ( Marshal . ( to_string x [ No_sharing ] ) ) ) |
let id : type s . s t -> string = function | Input { id ; _ } -> id | Select { id ; _ } -> id | Plugin { id ; _ } -> id | Pure { id ; _ } -> id | App { id ; _ } -> id | Spawn { id ; _ } -> id | Both { id ; _ } -> id | Eval_path { id ; _ } -> i... |
let any x = Any x |
let compare_token x y = match x , y with | Path_token wx , Path_token wy -> String . compare ( id wx ) ( id wy ) | Path_token _ , _ -> - 1 | Path_list_token x , Path_list_token y -> ( match String . compare ( id x . elts ) ( id y . elts ) with | 0 -> compare ( x . sep... |
module Any = struct module T = struct type t = any let id ( Any w ) = id w let compare x y = String . compare ( id x ) ( id y ) let equal x y = String . equal ( id x ) ( id y ) let hash x = Hashtbl . hash ( id x ) end module Set = Set . Make ( T ) module Table = Hashtbl . ... |
let input ? version path = let id = digest ( ` Input , path , version ) in Input { id ; path ; version } |
let select dir sel = let dir , sel = match dir with | Select { dir ; sel = root ; _ } -> dir , root @ sel | Input _ | Plugin _ | Shell _ -> dir , sel | _ -> assert false in let id = digest ( " select " , id dir , sel ) in Select { id ; dir ; sel } |
let pure ~ id value = Pure { id ; value } |
let data value = pure ~ id ( : digest value ) value |
let app f x = let id = digest ( ` App , id f , id x ) in App { id ; f ; x } |
let ( $ ) = app |
let both fst snd = let id = digest ( ` Both , id fst , id snd ) in Both { id ; fst ; snd } |
let add_mem_dep mem deps = match mem with | None -> deps | Some mem -> any mem :: deps |
let plugin ( ? descr = " " ) ( ? np = 1 ) ? mem ? version workflow = let id = digest ( ` Value , id workflow , version ) in Plugin { id ; descr ; np ; mem ; version ; task = Value_plugin workflow ; deps = add_mem_dep mem [ any workflow ] } |
let path_plugin ( ? descr = " " ) ( ? np = 1 ) ? mem ? version workflow = let id = digest ( ` Value , id workflow , version ) in Plugin { id ; descr ; np ; mem ; version ; task = Path_plugin workflow ; deps = add_mem_dep mem [ any workflow ] } |
let path w = Eval_path { id = digest ( ` Eval_path , id w ) ; workflow = w } |
let digestible_cmd = Command . map ~ f ( : function | Path_token w -> id w | Path_list_token { elts ; sep ; quote } -> digest ( id elts , sep , quote ) | String_token w -> id w ) |
let shell ( ? descr = " " ) ? mem ( ? np = 1 ) ? version ( ? img = [ ] ) cmds = let cmd = Command . And_list cmds in let shell_cmd = { cmd ; images = img ; } in let id = digest ( " shell " , version , digestible_cmd cmd ) in let deps = add_mem_dep mem ( Command... |
let list elts = let id = digest ( " list " , List . map id elts ) in List { id ; elts } |
let rec independent_workflows_aux cache w ~ from : u = if Any . equal w u then Any . Map . add w ( true , Any . Set . empty ) cache else if Any . Map . mem w cache then cache else ( let deps = Any . deps w in let f acc w = independent_workflows_aux acc w ~ from : u in let cache = List . ... |
let independent_workflows w ~ from : u = let cache = independent_workflows_aux Any . Map . empty w ~ from : u in Any . Map . find w cache |> snd |> Any . Set . elements |
let spawn elts ~ f = let hd = pure ~ id " : __should_never_be_executed__ " List . hd in let u = app hd elts in let f_u = f u in let id = digest ( ` Spawn , id elts , id f_u ) in let deps = any elts :: independent_workflows ( any f_u ) ~ from ( : any u ) in Spawn { id ; elts ; ... |
let list_nth w i = let id = digest ( ` List_nth , id w , i ) in List_nth { id ; elts = w ; index = i } |
let glob ? pattern ? type_selection dir = let id = digest ( ` Glob , id dir , pattern , type_selection ) in Glob { id ; dir ; pattern ; type_selection } |
let trywith w failsafe = let id = digest ( ` Trywith , id w , id failsafe ) in Trywith { id ; w ; failsafe } |
let ifelse cond _then_ _else_ = let id = digest ( ` Ifelse , id cond , id _then_ , id _else_ ) in Ifelse { id ; cond ; _then_ ; _else_ } |
module Remove = struct let file ~ run_with path = let open KEDSL in workflow_node nothing ~ name ( : sprintf " rm -% s " ( Filename . basename path ) ) ~ ensures ( ` : Is_verified ( ` Command_returns ( Command . shell ~ host : Machine . ( as_host run_with ) ( sprintf " ls ... |
module Gunzip = struct let concat ( ~ run_with : Machine . t ) bunch_of_dot_gzs ~ result_path = let open KEDSL in let program = Program . ( exec [ " mkdir " ; " - p " ; Filename . dirname result_path ] && shf " gunzip - c % s > % s " ( List . map bunch_of_dot_gzs ~ f ( ... |
module Cat = struct let concat ( ~ run_with : Machine . t ) bunch_of_files ~ result_path = let open KEDSL in let program = Program . ( exec [ " mkdir " ; " - p " ; Filename . dirname result_path ] && shf " cat % s > % s " ( List . map bunch_of_files ~ f ( : fun o -> F... |
module Download = struct let wget_program ? output_filename url = KEDSL . Program . exec [ " wget " ; " - O " ; Option . value output_filename ~ default : Filename . ( basename url ) ; url ] let wget_to_folder ~ host ( ~ run_program : Machine . Make_fun . t ) ~ test_file ... |
module Vcftools = struct let vcf_process_n_to_1_no_machine ~ host ~ vcftools ( ~ run_program : Machine . Make_fun . t ) ( ? more_edges = [ ] ) ~ vcfs ~ make_product ~ final_vcf command_prefix = let open KEDSL in let name = sprintf " % s -% s " command_prefix ( Filename . basename f... |
module Variable_tool_paths = struct let single_file ~ run_with ~ tool path = let open KEDSL in let condition = let init = Machine . Tool . init tool in let host = Machine . as_host ~ with_shell " : bash " run_with in let condition_cmd = Ketrew_pure . Program . to_single_shell_command Program . ... |
module type Work_list = sig type elt type t val empty : t val is_empty : t -> bool val push : Remanent_parameters_sig . parameters -> Exception . method_handler -> elt -> t -> Exception . method_handler * t val pop : Remanent_parameters_sig . parameters -> Exception . method_handler -> t -> Exce... |
module WlMake ( Ord : OrderedType with type t = int ) = ( struct module WSetMap = Map_wrapper . Make ( SetMap . Make ( Ord ) ) module WSet = WSetMap . Set type elt = Ord . t type t = elt list * elt list * WSet . t let empty = [ ] , [ ] , WSet . empty let is_empty x = let... |
type ' a working_list = { indice : int ; clean : unit -> unit ; pop : unit ' -> a option ; push : ' a -> unit ; list : unit -> ' a list ; exists : ( ' a -> bool ) -> bool ; member : ' a -> bool ; not_empty : unit -> bool ; copy : unit ' -> a working_list } |
let rec make n = let h = Hashtbl . create n in let l = Queue . create ( ) in let push a = try ( Hashtbl . find h a ) with _ -> ( Queue . add a l ; let pop ( ) = try ( let k = Queue . take l in Hashtbl . remove h k ; Some k ) with _ -> None in let not_empty ( ) = match po... |
let _wmap parameters _error f l = let rep = make ( Remanent_parameters . get_empty_hashtbl_size parameters ) in List . map ( fun x -> rep . push ( f x ) ) ( l . list ( ) ) |
let indice wl = wl . indice |
let clean wl = wl . clean ( ) |
let list wl = wl . list ( ) |
let pop wl = wl . pop ( ) |
let push a wl = wl . push a |
let exists p wl = wl . exists p |
let not_empty wl = wl . not_empty ( ) |
let copy wl = wl . copy ( ) |
let member a wl = wl . member a |
module Make = functor ( S : EqConstrSys ) -> functor ( HM : Hashtbl . S with type key = S . v ) -> struct include Generic . SolverStats ( S ) ( HM ) module VS = Set . Make ( S . Var ) open S . Dom let eq x get set = match S . system x with | None -> bot ( ) | Some f -> ... |
let _ = Selector . add_solver ( " WL " , ( module EqIncrSolverFromEqSolver ( Make ) ) ) ; |
module Cell = struct module Type = struct type t = | Boolean | Error | Inline_string | Number | Shared_string | Formula_string [ @@ deriving sexp_of ] let of_string = function | " b " -> Boolean | " e " -> Error | " inlineStr " -> Inline_string | " n " -> Number | " s " -> S... |
module Row = struct type t = { cells : Cell . t list ; collapsed : bool ; custom_format : bool ; custom_height : bool ; hidden : bool ; height : float option ; outline_level : uint8 ; show_phonetic : bool ; row_index : uint32 option ; style_index : uint32 ; thick_bottom_border : boo... |
module Column = struct type t = { best_fit : bool ; collapsed : bool ; custom_width : bool ; hidden : bool ; max : uint32 ; min : uint32 ; outline_level : uint8 ; show_phonetic : bool ; default_style : uint32 ; width : float option } [ @@ deriving fields , sexp_of ] let of_xml ... |
type t = { columns : Column . t list ; rows : Row . t list } [ @@ deriving fields , sexp_of ] |
let default = { columns = [ ] ; rows = [ ] } |
let of_xml = expect_element " worksheet " ( fun _ -> let open Xml in List . fold ~ init : default ~ f ( : fun acc -> function | Element ( " cols " , _ , children ) -> { acc with columns = List . filter_map children ~ f : Column . of_xml } | Element ( " sheetData " , ... |
type role = [ ` Chair | ` Co_chair ] |
let role_to_string = function ` Chair -> " chair " | ` Co_chair -> " co - chair " |
let role_of_string = function | " chair " -> Ok ` Chair | " co - chair " -> Ok ` Co_chair | _ -> Error ( ` Msg " Unknown role type ) " |
let role_of_yaml = function | ` String s -> Result . bind ( role_of_string s ) s ( fun t -> Ok t ) t | _ -> Error ( ` Msg " Expected a string for a role type ) " |
let role_to_yaml t = ` String ( role_to_string t ) t |
type important_date = { date : string ; info : string } [ @@ deriving yaml ] yaml |
type committee_member = { name : string ; role : role option ; affiliation : string option ; picture : string option ; } |
type presentation = { title : string ; authors : string list ; link : string option ; video : string option ; slides : string option ; poster : bool option ; additional_links : string list option ; } |
type metadata = { title : string ; location : string ; date : string ; important_dates : important_date list ; presentations : presentation list ; program_committee : committee_member list ; organising_committee : committee_member list ; } |
let path = Fpath . v " data / workshops " |
let parse content = let metadata , _ = Utils . extract_metadata_body content in metadata_of_yaml metadata |
type t = { title : string ; slug : string ; location : string ; date : string ; important_dates : important_date list ; presentations : presentation list ; program_committee : committee_member list ; organising_committee : committee_member list ; toc_html : string ; body_md : string ; b... |
let all ( ) = Utils . map_files ( fun content -> let metadata , body = Utils . extract_metadata_body content in let metadata = Utils . decode_or_raise metadata_of_yaml metadata in let omd = Omd . of_string body in { title = metadata . title ; slug = Utils . slugify metadata . title ; locat... |
let pp_role ppf = function | ` Chair -> Fmt . string ppf " ` Chair " | ` Co_chair -> Fmt . string ppf " ` Co_chair " |
let pp_important_date ppf ( v : important_date ) important_date = Fmt . pf ppf { | { date = % a ; info = % a ; } } | Pp . string v . date Pp . string v . info |
let pp_committee_member ppf ( v : committee_member ) committee_member = Fmt . pf ppf { | { name = % a ; role = % a ; affiliation = % a ; picture = % a ; } } | Pp . string v . name Pp ( . option pp_role ) pp_role v . role Pp ( . option string ) string v . affiliation Pp (... |
let pp_presentation ppf ( v : presentation ) presentation = Fmt . pf ppf { | { title = % a ; authors = % a ; link = % a ; video = % a ; slides = % a ; poster = % a ; additional_links = % a ; } } | Pp . string v . title Pp . string_list v . authors Pp ( . option strin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.