Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file dot_output.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187openCoreopenBistro_internalsopenBistro_enginemoduleW=WorkflowmoduleV=structincludeW.Anyletsexp_of_t_=assertfalselett_of_sexp_=assertfalseendmoduleE=structtypet=Dependency|GC_linkletdefault=Dependencyletcompare=compareendmoduleS=Set.Make(V)moduleG=structopenEincludeGraph.Persistent.Digraph.ConcreteLabeled(V)(E)(* let successors g u = fold_succ (fun h t -> h :: t) g u [] *)letrecof_workflow_auxseenaccu=ifS.memseenuthen(seen,acc)else(letdeps=W.Any.depsuinletseen,acc=List.folddeps~init:(seen,acc)~f:(fun(seen,acc)v->of_workflow_auxseenaccv)inletacc=add_vertexaccuinletacc=List.folddeps~init:acc~f:(funaccv->add_edgeaccuv)inletseen=S.addseenuinseen,acc)letof_workflowu=of_workflow_auxS.emptyempty(W.Anyu)|>sndletof_gc_state?(condensed=false){Scheduler.Gc.deps;_}=letbackbone=ifcondensedthenemptyelseList.folddeps~init:(S.empty,empty)~f:(fun(seen,acc)(u,v)->letseen,acc=of_workflow_auxseenaccuinof_workflow_auxseenaccv)|>sndinList.folddeps~init:backbone~f:(funacc(u,v)->lete=E.createuGC_linkvinadd_edge_eacce)letis_path(W.Anyw)=matchwwith|Plugin_->true|Shell_->true|Input_->true|Select_->true|Pure_->false|App_->false|Eval_path_->false|Both_->false|List_->false|Spawn_->false|List_nth_->false|Glob_->falseletreduce_to_pathsg=letforeach_vertexvacc=ifis_pathvthenaccelse(letfpacc=fold_succ(funsacc->add_edgeaccps)accvaccinremove_vertex(fold_predfaccvacc)v)infold_vertexforeach_vertexggendletlight_gray=0xC0C0C0letblack=0letshape=function|_->`Boxletdot_output?dbocg~needed=letalready_done=matchdbwith|None->Fn.constfalse|Somedb->Db.is_in_cachedbinletlabeldescru=`Label(sprintf"%s.%s"descr(String.prefix(W.Any.idu)6))inletstep_attributes~descru=letalready_done=already_doneuinletcolor=blackinletshape=`Shape(shapeu)in[labeldescru;shape;`Peripheries(ifalready_donethen2else1);`Colorcolor;`Fontcolorcolor;]inletvertex_attributesu=letneeded=db=None||S.memneededuinletcolor=ifneededthenblackelselight_grayinletshape=`Shape(shapeu)inletW.Anyw=uinmatchwwith|W.Inputi->letlabel=i.pathin[`Labellabel;`Colorcolor;`Fontcolorcolor;shape]|Selects->letlabel=Path.to_strings.selin[`Labellabel;`Fontcolorcolor;`Colorcolor;shape]|Shell{descr;_}->step_attributes~descru|Plugin{descr;_}->step_attributes~descru|Pure_->[label"pure"u;`Shape`Plaintext]|App_->[label"app"u;`Shape`Plaintext]|Spawn_->[label"spawn"u;`Shape`Ellipse]|Both_->[label"both"u;`Shape`Plaintext]|List_->[label"list"u;`Shape`Plaintext]|Glob_->[label"glob"u;`Shape`Plaintext]|Eval_path_->[label"path"u;`Shape`Plaintext]|List_nthl->[label(sprintf"list_nth_%d"l.index)u;`Shape`Plaintext]inletedge_attributese=letu=G.E.srceandv=G.E.dsteinletstyle=matchu,v,G.E.labelewith|_,_,GC_link->[`Style`Dotted]|W.AnyW.Select_,_,Dependency->[`Style`Dashed]|_->[]inletcolor=ifdb=None||(S.memneededu&¬(already_doneu))thenblackelselight_grayinstyle@[`Colorcolor]inletmoduleG=structincludeGletgraph_attributes_=[]letdefault_vertex_attributes_=[]letvertex_namet=sprintf"\"%s\""(W.Any.idt)letvertex_attributes=vertex_attributesletedge_attributes=edge_attributesletget_subgraph_=Noneletdefault_edge_attributes_=[]endinletmoduleDot=Graph.Graphviz.Dot(G)inDot.output_graphocg(* class logger path : Scheduler.logger =
* object
* method event config _ = function
* | Scheduler.Init { dag ; needed ; already_done } ->
* let needed = S.of_list needed in
* let already_done = S.of_list already_done in
* dot_output dag ~needed ~already_done path ~precious:config.Task.precious
* | _ -> ()
*
* method stop = ()
*
* method wait4shutdown = Lwt.return ()
* end
*
* let create path = new logger path *)letworkflow_to_channel?db?(reduce=false)ocw=letdep_graph=G.of_workflow(Bistro.Private.revealw)inletdep_graph=ifreducethenG.reduce_to_pathsdep_graphelsedep_graphinletmoduleO=Graph.Oper.P(G)indot_output~needed:S.empty?dboc(O.mirrordep_graph)letworkflow_to_file?db?reducefnw=Out_channel.with_filefn~f:(funoc->workflow_to_channel?db?reduceocw)letgc_state_to_channel?condensed?dbocgcs=letdep_graph=G.of_gc_state?condensedgcsindot_output~needed:S.empty?dbocdep_graphletgc_state_to_file?condensed?dbfnw=Out_channel.with_filefn~f:(funoc->gc_state_to_channel?condensed?dbocw)