Feat: reactivate output in task
This commit is contained in:
@@ -11,47 +11,54 @@ class Task:
|
||||
action: str
|
||||
args: dict
|
||||
deps: list
|
||||
output: str
|
||||
|
||||
|
||||
def generate(template: str, meta: dict):
|
||||
def generate(template: str, meta: dict, output: str):
|
||||
"""Create a task to generate a subject"""
|
||||
return Task(
|
||||
action="GENERATE",
|
||||
args=meta,
|
||||
deps=[template],
|
||||
output=output,
|
||||
)
|
||||
|
||||
|
||||
def activate_corr_on(src: str):
|
||||
def activate_corr_on(src: str, output: str):
|
||||
"""Create a task to activate correction for src"""
|
||||
return Task(
|
||||
action="ACTIVATE_CORR",
|
||||
args={},
|
||||
deps=[src],
|
||||
output=output,
|
||||
)
|
||||
|
||||
|
||||
def compile_pdf(src: str):
|
||||
def compile_pdf(src: str, output: str):
|
||||
"""Create a task to compile src"""
|
||||
return Task(
|
||||
action="COMPILE",
|
||||
args={},
|
||||
deps=[src],
|
||||
output=output,
|
||||
)
|
||||
|
||||
def join_pdfs(pdfs: list):
|
||||
""" Create task to join pdf together """
|
||||
|
||||
def join_pdfs(pdfs: list, output: str):
|
||||
"""Create task to join pdf together"""
|
||||
return Task(
|
||||
action="JOIN",
|
||||
args={},
|
||||
deps=pdfs,
|
||||
output=output,
|
||||
)
|
||||
|
||||
|
||||
def clean(files: list):
|
||||
""" Create task to clean files"""
|
||||
"""Create task to clean files"""
|
||||
return Task(
|
||||
action="CLEAN",
|
||||
args={},
|
||||
deps=files,
|
||||
output=None,
|
||||
)
|
||||
|
@@ -20,7 +20,7 @@ class Scheduler:
|
||||
|
||||
def dispatch(self, task):
|
||||
"""Do a task"""
|
||||
ans = self.actions[task.action](task.deps, task.args)
|
||||
ans = self.actions[task.action](task.deps, task.args, task.output)
|
||||
return ans
|
||||
|
||||
def __iter__(self):
|
||||
@@ -47,7 +47,7 @@ class Scheduler:
|
||||
|
||||
self.append(undoable)
|
||||
ans = self.dispatch(task)
|
||||
self._done.append(ans)
|
||||
self._done.append(task.output)
|
||||
return ans
|
||||
|
||||
def run(self):
|
||||
|
Reference in New Issue
Block a user