aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-05-27 00:31:24 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-05-27 00:31:24 +0200
commit953a34c1252e8ee01660d7128cb5e14a87dee35e (patch)
tree7e057f90c3c95ef38a0bd49e7acbf299fbdf44b6 /python
parentcecfa8b4c42182fbe50c10eefd92bf2b57faef66 (diff)
downloadrefcat-953a34c1252e8ee01660d7128cb5e14a87dee35e.tar.gz
refcat-953a34c1252e8ee01660d7128cb5e14a87dee35e.zip
tasks: add OpenLibraryMapped
Diffstat (limited to 'python')
-rw-r--r--python/refcat/tasks.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py
index 6767a7c..a67e430 100644
--- a/python/refcat/tasks.py
+++ b/python/refcat/tasks.py
@@ -765,6 +765,31 @@ class OpenLibraryRelease(Refcat):
def output(self):
return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd)
+class OpenLibraryMapped(Refcat):
+ """
+ A mapped open library editions set.
+ """
+ mapper = luigi.Parameter(default="ts", description="mapper short name")
+
+ def requires(self):
+ return OpenLibraryRelease()
+
+ def run(self):
+ output = shellout("""
+ zstdcat -T0 {input} |
+ skate-map -m {mapper} -skip-on-empty 1 |
+ LC_ALL=C sort -T {tmpdir} -k1,1 -S25% --parallel 4 |
+ zstd -T0 -c > {output}
+ """,
+ n=self.n,
+ mapper=self.mapper,
+ tmpdir=self.tmpdir,
+ input=self.input().path)
+ luigi.LocalTarget(output).move(self.output().path)
+
+ def output(self):
+ return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd)
+
class UnmatchedMapped(Refcat):
"""