MCPcopy
hub / github.com/treeverse/dvc / ExecutorInfo

Class ExecutorInfo

dvc/repo/experiments/executor/base.py:64–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62
63@dataclass
64class ExecutorInfo:
65 git_url: str
66 baseline_rev: str
67 location: str
68 root_dir: str
69 dvc_dir: str
70 name: Optional[str] = None
71 wdir: Optional[str] = None
72 result_hash: Optional[str] = None
73 result_ref: Optional[str] = None
74 result_force: bool = False
75 status: TaskStatus = TaskStatus.PENDING
76
77 @classmethod
78 def from_dict(cls, d):
79 if d.pop("collected", None):
80 d["status"] = TaskStatus.FINISHED
81 return cls(**d)
82
83 def asdict(self):
84 return asdict(self)
85
86 @property
87 def result(self) -> Optional["ExecutorResult"]:
88 if self.result_hash is None:
89 return None
90 return ExecutorResult(
91 self.result_hash,
92 ExpRefInfo.from_ref(self.result_ref) if self.result_ref else None,
93 self.result_force,
94 )
95
96 def dump_json(self, filename: str):
97 from dvc.utils.serialize import modify_json
98
99 os.makedirs(os.path.dirname(filename), exist_ok=True)
100 with modify_json(filename) as d:
101 d.update(self.asdict())
102
103 @classmethod
104 def load_json(cls, filename: str) -> "ExecutorInfo":
105 from dvc.utils.serialize import load_json
106
107 return cls.from_dict(load_json(filename))
108
109
110class BaseExecutor(ABC):

Callers 2

make_executor_infoFunction · 0.90
infoMethod · 0.85

Calls

no outgoing calls

Tested by 1

make_executor_infoFunction · 0.72