Skip to content

Commit 82a2102

Browse files
feat: adding namespaces (#226)
1 parent bd40799 commit 82a2102

File tree

20 files changed

+346
-235
lines changed

20 files changed

+346
-235
lines changed

.github/workflows/docker-ci.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jobs:
4747
echo "Waiting for container to start..."
4848
sleep 30
4949
50+
frontend_healthy=false
51+
5052
# Check container health for up to 3 minutes
5153
for i in {1..6}; do
5254
if ! docker ps -q -f name=docetl-test > /dev/null 2>&1; then
@@ -56,8 +58,9 @@ jobs:
5658
fi
5759
5860
# Try to curl the frontend
59-
if curl -s -f http://localhost:3000 > /dev/null; then
61+
if curl -s -f http://localhost:3000/playground > /dev/null; then
6062
echo "Frontend is responding"
63+
frontend_healthy=true
6164
break
6265
fi
6366
@@ -71,6 +74,13 @@ jobs:
7174
sleep 30
7275
done
7376
77+
# Explicitly fail if frontend check never succeeded
78+
if [ "$frontend_healthy" = false ]; then
79+
echo "Frontend health check failed"
80+
docker logs docetl-test
81+
exit 1
82+
fi
83+
7484
# If we get here, container is running and healthy
7585
echo "Container is running successfully"
7686

docetl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.1.7"
1+
__version__ = "0.2"
22

33
from docetl.runner import DSLRunner
44
from docetl.builder import Optimizer

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "docetl"
3-
version = "0.1.7"
3+
version = "0.2"
44
description = "ETL with LLM operations."
55
authors = ["Shreya Shankar <[email protected]>"]
66
license = "MIT"

tailwind.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
theme: {
3+
extend: {
4+
keyframes: {
5+
shake: {
6+
'0%, 100%': { transform: 'translateX(0)' },
7+
'25%': { transform: 'translateX(-4px)' },
8+
'75%': { transform: 'translateX(4px)' },
9+
},
10+
},
11+
animation: {
12+
shake: 'shake 0.2s ease-in-out 0s 2',
13+
},
14+
},
15+
},
16+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { NextResponse } from "next/server";
2+
import fs from "fs";
3+
import { getNamespaceDir } from "@/app/api/utils";
4+
import os from "os";
5+
6+
export async function POST(request: Request) {
7+
try {
8+
const { namespace } = await request.json();
9+
const homeDir = process.env.DOCETL_HOME_DIR || os.homedir();
10+
11+
if (!namespace) {
12+
return NextResponse.json(
13+
{ error: "Namespace parameter is required" },
14+
{ status: 400 }
15+
);
16+
}
17+
18+
const namespaceDir = getNamespaceDir(homeDir, namespace);
19+
const exists = fs.existsSync(namespaceDir);
20+
21+
if (!exists) {
22+
fs.mkdirSync(namespaceDir, { recursive: true });
23+
}
24+
25+
return NextResponse.json({ exists });
26+
} catch (error) {
27+
console.error("Error checking/creating namespace:", error);
28+
return NextResponse.json(
29+
{ error: "Failed to check/create namespace" },
30+
{ status: 500 }
31+
);
32+
}
33+
}

website/src/app/api/getInputOutput/route.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ import fs from "fs/promises";
44
import os from "os";
55
export async function POST(request: Request) {
66
try {
7-
const { default_model, data, operations, operation_id, name, sample_size } =
8-
await request.json();
7+
const {
8+
default_model,
9+
data,
10+
operations,
11+
operation_id,
12+
name,
13+
sample_size,
14+
namespace,
15+
} = await request.json();
916

1017
if (!name) {
1118
return NextResponse.json(
@@ -29,7 +36,8 @@ export async function POST(request: Request) {
2936
operation_id,
3037
name,
3138
homeDir,
32-
sample_size
39+
sample_size,
40+
namespace
3341
);
3442

3543
// Check if inputPath exists

website/src/app/api/getPipelineConfig/route.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export async function POST(request: Request) {
1010
operation_id,
1111
name,
1212
sample_size,
13+
namespace,
1314
system_prompt,
1415
} = await request.json();
1516

@@ -37,6 +38,7 @@ export async function POST(request: Request) {
3738
name,
3839
homeDir,
3940
sample_size,
41+
namespace,
4042
system_prompt
4143
);
4244

website/src/app/api/runPipeline/route.ts

Lines changed: 0 additions & 198 deletions
This file was deleted.

website/src/app/api/saveDocuments/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export async function POST(request: NextRequest) {
1313
try {
1414
const formData = await request.formData();
1515
const files = formData.getAll("files") as File[];
16+
const namespace = formData.get("namespace") as string;
1617

1718
if (!files || files.length === 0) {
1819
return NextResponse.json({ error: "No files provided" }, { status: 400 });
@@ -21,7 +22,7 @@ export async function POST(request: NextRequest) {
2122
const homeDir = process.env.DOCETL_HOME_DIR || os.homedir();
2223

2324
// Create uploads directory in user's home directory if it doesn't exist
24-
const uploadsDir = path.join(homeDir, ".docetl", "documents");
25+
const uploadsDir = path.join(homeDir, ".docetl", namespace, "documents");
2526
await mkdir(uploadsDir, { recursive: true });
2627

2728
const savedFiles = await Promise.all(

website/src/app/api/uploadFile/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export async function POST(request: NextRequest) {
88
try {
99
const formData = await request.formData();
1010
const file = formData.get("file") as File;
11-
11+
const namespace = formData.get("namespace") as string;
1212
if (!file) {
1313
return NextResponse.json({ error: "No file uploaded" }, { status: 400 });
1414
}
@@ -19,7 +19,7 @@ export async function POST(request: NextRequest) {
1919

2020
// Create uploads directory in user's home directory if it doesn't exist
2121
const homeDir = process.env.DOCETL_HOME_DIR || os.homedir();
22-
const uploadDir = path.join(homeDir, ".docetl", "files");
22+
const uploadDir = path.join(homeDir, ".docetl", namespace, "files");
2323
await mkdir(uploadDir, { recursive: true });
2424

2525
// Create full file path

0 commit comments

Comments
 (0)