Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file workflow.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241typepath=|FS_pathofstring|Cache_idofstring|Cdofpath*stringlistletcddirsel=matchdirwith|Cd(indir,insel)->Cd(indir,insel@sel)|FS_path_|Cache_id_->Cd(dir,sel)type_t=|Pure:{id:string;value:'a}->'at|App:{id:string;f:('a->'b)t;x:'at;}->'bt|Both:{id:string;fst:'at;snd:'bt;}->('a*'b)t|List:{id:string;elts:'atlist;}->'alistt|Eval_path:{id:string;workflow:patht}->stringt|Spawn:{id:string;elts:'alistt;f:'at->'bt;deps:anylist;}->'blistt|List_nth:{id:string;elts:'alistt;index:int;}->'at|Input:{id:string;path:string;version:intoption}->patht|Select:{id:string;dir:patht;sel:stringlist;}->patht|Plugin:('aplugin,any)step->'at|Shell:(shell_command,any)step->patht|Glob:{id:string;pattern:stringoption;type_selection:[`File|`Directory]option;dir:patht;}->pathlisttand('a,'b)step={id:string;descr:string;task:'a;np:int;(** Required number of processors *)mem:inttoption;(** Required memory in MB *)version:intoption;(** Version number of the wrapper *)deps:'blist;}and'aplugin=|Value_plugin:(unit->'a)t->'aplugin|Path_plugin:(string->unit)t->pathpluginandshell_command=tokenCommand.tandtoken=|Path_tokenofpatht|Path_list_tokenof{elts:pathlistt;sep:string;quote:charoption;}|String_tokenofstringtandany=Any:_t->anyletdigestx=Digest.to_hex(Digest.string(Marshal.to_stringx[]))letid:types.st->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;_}->id|Shell{id;_}->id|List{id;_}->id|List_nth{id;_}->id|Glob{id;_}->idletanyx=AnyxmoduleAny=structtypet=anyletid(Anyw)=idwletcomparexy=String.compare(idx)(idy)letequalxy=String.equal(idx)(idy)lethashx=Hashtbl.hash(idx)letdeps(Anyw)=matchwwith|Pure_->[]|Appapp->[Anyapp.f;Anyapp.x]|Bothp->[Anyp.fst;Anyp.snd]|Listl->List.mapanyl.elts|Eval_path{workflow;_}->[Anyworkflow]|Spawns->s.deps|List_nthl->[Anyl.elts]|Input_->[]|Selectsel->[anysel.dir]|Pluginv->v.deps|Shells->s.deps|Globg->[Anyg.dir]endletinput?versionpath=letid=digest(`Input,path,version)inInput{id;path;version}letselectdirsel=letdir,sel=matchdirwith|Select{dir;sel=root;_}->dir,root@sel|Input_|Plugin_|Shell_->dir,sel|_->assertfalseinletid=digest("select",iddir,sel)inSelect{id;dir;sel}letpure~idvalue=Pure{id;value}letpure_datavalue=pure~id:(digestvalue)valueletint=pure_dataletstring=pure_dataletappfx=letid=digest(`App,idf,idx)inApp{id;f;x}let($)=appletbothfstsnd=letid=digest(`Both,idfst,idsnd)inBoth{id;fst;snd}letadd_mem_depmemdeps=matchmemwith|None->deps|Somemem->anymem::depsletcached_value?(descr="")?(np=1)?mem?versionworkflow=letid=digest(`Value,idworkflow,version)inPlugin{id;descr;np;mem;version;task=Value_pluginworkflow;deps=add_mem_depmem[anyworkflow]}letcached_path?(descr="")?(np=1)?mem?versionworkflow=letid=digest(`Value,idworkflow,version)inPlugin{id;descr;np;mem;version;task=Path_pluginworkflow;deps=add_mem_depmem[anyworkflow]}leteval_pathw=Eval_path{id=digest(`Eval_path,idw);workflow=w}letdigestible_cmd=Command.map~f:(function|Path_tokenw->idw|Path_list_token{elts;sep;quote}->digest(idelts,sep,quote)|String_tokenw->idw)letshell?(descr="")?mem?(np=1)?versioncmds=letcmd=Command.And_listcmdsinletid=digest("shell",version,digestible_cmdcmd)inletdeps=add_mem_depmem(Command.depscmd|>List.map(function|Path_tokenw->anyw|Path_list_token{elts;_}->anyelts|String_tokens->anys))inShell{descr;task=cmd;np;mem;version;id;deps}letlistelts=letid=digest("list",List.mapidelts)inList{id;elts}moduleSet=Set.Make(Any)moduleTable=Hashtbl.Make(Any)moduleMap=Map.Make(Any)letrecindependent_workflows_auxcachew~from:u=ifAny.equalwuthenMap.addw(true,Set.empty)cacheelseifMap.memwcachethencacheelse(letdeps=Any.depswinletfaccw=independent_workflows_auxaccw~from:uinletcache=List.fold_leftfcachedepsinletchildren=List.map(funk->Map.findkcache)depsinifList.existsfstchildrenthenletunion=List.fold_left(funacc(_,s)->Set.unionaccs)Set.emptychildreninMap.addw(true,union)cacheelseMap.addw(false,Set.singletonw)cache)letindependent_workflowsw~from:u=letcache=independent_workflows_auxMap.emptyw~from:uinMap.findwcache|>snd|>Set.elementsletspawnelts~f=lethd=pure~id:"__should_never_be_executed__"List.hdinletu=apphdeltsinletf_u=fuinletid=digest(`Spawn,idelts,idf_u)inletdeps=anyelts::independent_workflows(anyf_u)~from:(anyu)inSpawn{id;elts;f;deps}letlist_nthwi=letid=digest(`List_nth,idw,i)inList_nth{id;elts=w;index=i}letglob?pattern?type_selectiondir=letid=digest(`Glob,iddir,pattern,type_selection)inGlob{id;dir;pattern;type_selection}