Skip to content

Commit

Permalink
reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshKarpel committed Jun 26, 2024
1 parent 0932533 commit f902416
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions synthesize/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ class FlowNode(Model):

color: str

def write_script(self, tmp_dir: Path, flow_args: Args) -> Path:
def write_script(self, tmp_dir: Path, args: Args) -> Path:
path = tmp_dir / f"{self.id}-{md5(self.model_dump_json().encode())}"

path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(
self.target.render(
args=flow_args
args=args
| self.args
| {
"id": self.id,
Expand Down
9 changes: 5 additions & 4 deletions synthesize/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from frozendict import frozendict

from synthesize.config import Flow, FlowNode
from synthesize.config import Args, Envs, FlowNode
from synthesize.messages import ExecutionCompleted, ExecutionOutput, ExecutionStarted, Message


Expand All @@ -28,19 +28,20 @@ class Execution:
async def start(
cls,
node: FlowNode,
flow: Flow,
args: Args,
envs: Envs,
events: Queue[Message],
tmp_dir: Path,
width: int = 80,
) -> Execution:
path = node.write_script(tmp_dir=tmp_dir, flow_args=flow.args)
path = node.write_script(tmp_dir=tmp_dir, args=args)

process = await create_subprocess_exec(
program=path,
stdout=PIPE,
stderr=STDOUT,
env=frozendict(os.environ)
| flow.envs
| envs
| node.envs
| {
"FORCE_COLOR": "1",
Expand Down
3 changes: 2 additions & 1 deletion synthesize/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ async def start_ready_targets(self, tmp_dir: Path) -> None:
async def start() -> None:
e = await Execution.start(
node=ready_node,
flow=self.flow,
args=self.flow.args,
envs=self.flow.envs,
events=self.inbox,
width=self.console.width - self.renderer.prefix_width,
tmp_dir=tmp_dir,
Expand Down

0 comments on commit f902416

Please sign in to comment.