File size: 515 Bytes
4962437
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from typing import List, Dict, Any, Union
from concurrent.futures import Executor, ThreadPoolExecutor, as_completed
from graphlib import TopologicalSorter

class Task:
    def __init__(
        self,
        id: str, 
        parents: List["Task"] = None,
        children: List["Task"] = None
    ):
        self.id = id
        self.parents = parents
        self.children = children
    
    def can_execute(self):
        raise NotImplementedError

    def execute(self):
        raise NotImplementedError