diff options
author | Ralph Amissah <ralph@amissah.com> | 2018-08-04 23:53:50 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:15 -0400 |
commit | e3069103f1db73076b0ce8b645729a9744648dd7 (patch) | |
tree | 8fde121b508462d5fea148c3cfa1d0bfc25b35f6 /src/sdp/output | |
parent | catches (diff) |
nested parallelisation, output task scheduler
- default off, --pp2 to use
Diffstat (limited to 'src/sdp/output')
-rw-r--r-- | src/sdp/output/hub.d | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/src/sdp/output/hub.d b/src/sdp/output/hub.d index 75be424..832cda8 100644 --- a/src/sdp/output/hub.d +++ b/src/sdp/output/hub.d @@ -12,55 +12,54 @@ template outputHub() { sdp.output.source_sisupod, sdp.output.create_zip_file, sdp.output.paths_output; + import std.parallelism; void outputHub(D,I)(D doc_abstraction, I doc_matters) { mixin SiSUoutputRgxInit; mixin Msg; auto msg = Msg!()(doc_matters); static auto rgx = Rgx(); - if (doc_matters.opt.action.verbose) { - writeln(doc_matters.xml.keys_seq.seg); - } - if ((doc_matters.opt.action.source) - || (doc_matters.opt.action.sisupod)) { - if (doc_matters.opt.action.source) { - msg.v("sisu source processing..."); + enum outTask { sisupod, source, sqlite, sqlite_multi, epub, html_scroll, html_seg, html_stuff } + void Scheduled(D,I)(int sched, D doc_abstraction, I doc_matters) { + auto msg = Msg!()(doc_matters); + if (sched == outTask.sisupod) { + msg.v("sisu source processing... "); + SiSUpod!()(doc_matters); + msg.vv("sisu source done"); } - if (doc_matters.opt.action.sisupod) { - msg.v("sisupod source processing..."); + if (sched == outTask.sqlite) { + msg.v("sqlite processing... "); + SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_abstraction, doc_matters); + msg.vv("sqlite done"); } - SiSUpod!()(doc_matters); - if (doc_matters.opt.action.source) { - msg.vv("sisu source done"); + if (sched == outTask.epub) { + msg.v("epub3 processing... "); + outputEPub3!()(doc_abstraction, doc_matters); + msg.vv("epub3 done"); } - if (doc_matters.opt.action.sisupod) { - msg.v("sisupod source done"); + if (sched == outTask.html_scroll) { + msg.v("html scroll processing... "); + outputHTML!().scroll(doc_abstraction, doc_matters); + msg.vv("html scroll done"); + } + if (sched == outTask.html_seg) { + msg.v("html seg processing... "); + outputHTML!().seg(doc_abstraction, doc_matters); + msg.vv("html seg done"); + } + if (sched == outTask.html_stuff) { + outputHTML!().css(doc_matters); + outputHTML!().images_cp(doc_matters); + msg.vv("html css & images done"); } } - if (doc_matters.opt.action.html_seg) { - msg.v("html seg source processing..."); - outputHTML!().seg(doc_abstraction, doc_matters); - msg.vv("html seg done"); - } - if (doc_matters.opt.action.html_scroll) { - msg.v("html scroll source processing..."); - outputHTML!().scroll(doc_abstraction, doc_matters); - msg.vv("html scroll done"); - } - if (doc_matters.opt.action.html_stuff) { - msg.v("html copying images & css..."); - outputHTML!().css(doc_matters); - outputHTML!().images_cp(doc_matters); - msg.vv("html css & images done"); - } - if (doc_matters.opt.action.epub) { - msg.v("epub3 source processing..."); - outputEPub3!()(doc_abstraction, doc_matters); - msg.vv("epub3 done"); - } - if (doc_matters.opt.action.sqlite_discrete) { - msg.v("sqlite processing..."); - SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_abstraction, doc_matters); - msg.vv("sqlite done"); + if (!(doc_matters.opt.action.pp2)) { + foreach(schedule; doc_matters.opt.action.output_task_scheduler) { + Scheduled!()(schedule, doc_abstraction, doc_matters); + } + } else { + foreach(schedule; parallel(doc_matters.opt.action.output_task_scheduler)) { + Scheduled!()(schedule, doc_abstraction, doc_matters); + } } if (doc_matters.opt.action.sqlite_insert || doc_matters.opt.action.sqlite_update |