Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: DSLRunner now uses a pull-based execution model #273

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ repos:
- id: check-docstring-first

- repo: https://github.com/hadialqattan/pycln
rev: v2.4.0
rev: v2.5.0
hooks:
- id: pycln
args: [--all]
args: [--all, --exclude, "__init__.py$", --include, "^docetl/"]

- repo: https://github.com/psf/black
rev: 24.1.1
Expand Down
2 changes: 1 addition & 1 deletion docetl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__version__ = "0.2.1"

from docetl.runner import DSLRunner
from docetl.builder import Optimizer
from docetl.optimizer import Optimizer

__all__ = ["DSLRunner", "Optimizer"]
20 changes: 10 additions & 10 deletions docetl/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,31 @@
result = optimized_pipeline.run()
"""

import os
import inspect
from typing import Any, Dict, List, Optional, Callable, Union
import os
from typing import Any, Callable, Dict, List, Optional, Union

import yaml
from rich import print

from docetl.builder import Optimizer
from docetl.runner import DSLRunner
from docetl.schemas import (
ClusterOp,
Dataset,
EquijoinOp,
FilterOp,
GatherOp,
MapOp,
ReduceOp,
ResolveOp,
SplitOp,
UnnestOp,
ClusterOp,
SampleOp,
OpType,
ParallelMapOp,
ParsingTool,
PipelineOutput,
PipelineStep,
ReduceOp,
ResolveOp,
SampleOp,
SplitOp,
UnnestOp,
)


Expand Down Expand Up @@ -166,9 +165,10 @@ def __init__(
self._load_env()

def _load_env(self):
from dotenv import load_dotenv
import os

from dotenv import load_dotenv

# Get the current working directory
cwd = os.getcwd()

Expand Down
6 changes: 4 additions & 2 deletions docetl/base_schemas.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import Any, Dict, List, Optional, Union

from pydantic import BaseModel, Field, field_validator
from pydantic import BaseModel

# from ..operations import map
# MapOp = map.MapOperation.schema


class ToolFunction(BaseModel):
name: str
description: str
Expand Down Expand Up @@ -96,7 +97,8 @@ class PipelineStep(BaseModel):
name: str
operations: List[Union[Dict[str, Any], str]]
input: Optional[str] = None



class PipelineOutput(BaseModel):
"""
Represents the output configuration for a pipeline.
Expand Down
Loading
Loading