Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

Commit

Permalink
General refactor, support for Pipeline in Pipeline and Block in Block…
Browse files Browse the repository at this point in the history
…, extract responsibility of iteration from TaskResolver into TaskIterator, add execution event summary, [BC] move table formatting to IO
  • Loading branch information
blackandred committed Sep 28, 2021
1 parent c491942 commit ad7265e
Show file tree
Hide file tree
Showing 20 changed files with 1,203 additions and 474 deletions.
35 changes: 1 addition & 34 deletions src/core/rkd/core/api/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ def find_all_tasks(self) -> Dict[str, Union[TaskDeclarationInterface, GroupDecla

class ExecutorInterface(AbstractClass):
@abstractmethod
def execute(self, task: TaskDeclarationInterface, task_num: int,
parent: Union[GroupDeclarationInterface, None] = None, args: list = []):
def execute(self, scheduled_declaration, task_num: int):
pass


Expand Down Expand Up @@ -524,38 +523,6 @@ def __str__(self):
extends=self.extends_task()
)

@staticmethod
def table(header: list, body: list, tablefmt: str = "simple",
floatfmt: str = 'g',
numalign: str = "decimal",
stralign:str = "left",
missingval: str = '',
showindex: str = "default",
disable_numparse: bool = False,
colalign: str = None):

"""Renders a table
Parameters:
header:
body:
tablefmt:
floatfmt:
numalign:
stralign:
missingval:
showindex:
disable_numparse:
colalign:
Returns:
Formatted table as string
"""

return tabulate(body, headers=header, floatfmt=floatfmt, numalign=numalign, tablefmt=tablefmt,
stralign=stralign, missingval=missingval, showindex=showindex,
disable_numparse=disable_numparse, colalign=colalign)

@property
def is_internal(self) -> bool:
return False
Expand Down
33 changes: 33 additions & 0 deletions src/core/rkd/core/api/inputoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
import os
import subprocess
from tabulate import tabulate
from io import StringIO
from traceback import format_exc as py_format_exception
from json import dumps as json_encode
Expand Down Expand Up @@ -447,6 +448,38 @@ def _process_output(self, text, origin: str):

return text

@staticmethod
def format_table(header: list, body: list, tablefmt: str = "simple",
floatfmt: str = 'g',
numalign: str = "decimal",
stralign: str = "left",
missingval: str = '',
showindex: str = "default",
disable_numparse: bool = False,
colalign: str = None):

"""Renders a table
Parameters:
header:
body:
tablefmt:
floatfmt:
numalign:
stralign:
missingval:
showindex:
disable_numparse:
colalign:
Returns:
Formatted table as string
"""

return tabulate(body, headers=header, floatfmt=floatfmt, numalign=numalign, tablefmt=tablefmt,
stralign=stralign, missingval=missingval, showindex=showindex,
disable_numparse=disable_numparse, colalign=colalign)


class SystemIO(IO):
""" Used for logging outside of tasks """
Expand Down

0 comments on commit ad7265e

Please sign in to comment.