fairchild 0.0.3__tar.gz → 0.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {fairchild-0.0.3 → fairchild-0.0.4}/PKG-INFO +1 -1
  2. fairchild-0.0.4/fairchild/db/migrations/001_initial.sql +59 -0
  3. fairchild-0.0.4/fairchild/db/migrations/002_add_parent_id.sql +8 -0
  4. fairchild-0.0.4/fairchild/db/migrations/003_remove_workflows.sql +9 -0
  5. fairchild-0.0.4/fairchild/db/migrations/004_add_workers.sql +16 -0
  6. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild.egg-info/PKG-INFO +1 -1
  7. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild.egg-info/SOURCES.txt +4 -0
  8. {fairchild-0.0.3 → fairchild-0.0.4}/pyproject.toml +2 -2
  9. {fairchild-0.0.3 → fairchild-0.0.4}/LICENSE +0 -0
  10. {fairchild-0.0.3 → fairchild-0.0.4}/README.md +0 -0
  11. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/__init__.py +0 -0
  12. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/cli.py +0 -0
  13. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/context.py +0 -0
  14. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/db/__init__.py +0 -0
  15. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/db/migrations.py +0 -0
  16. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/fairchild.py +0 -0
  17. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/future.py +0 -0
  18. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/job.py +0 -0
  19. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/record.py +0 -0
  20. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/task.py +0 -0
  21. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/templates/dashboard.html +0 -0
  22. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/templates/job.html +0 -0
  23. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/ui.py +0 -0
  24. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild/worker.py +0 -0
  25. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild.egg-info/dependency_links.txt +0 -0
  26. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild.egg-info/entry_points.txt +0 -0
  27. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild.egg-info/requires.txt +0 -0
  28. {fairchild-0.0.3 → fairchild-0.0.4}/fairchild.egg-info/top_level.txt +0 -0
  29. {fairchild-0.0.3 → fairchild-0.0.4}/setup.cfg +0 -0
  30. {fairchild-0.0.3 → fairchild-0.0.4}/tests/test_cli.py +0 -0
  31. {fairchild-0.0.3 → fairchild-0.0.4}/tests/test_integration.py +0 -0
  32. {fairchild-0.0.3 → fairchild-0.0.4}/tests/test_job.py +0 -0
  33. {fairchild-0.0.3 → fairchild-0.0.4}/tests/test_record.py +0 -0
  34. {fairchild-0.0.3 → fairchild-0.0.4}/tests/test_task.py +0 -0
  35. {fairchild-0.0.3 → fairchild-0.0.4}/tests/test_web_ui.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fairchild
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Workflow scheduling with PostgreSQL
5
5
  Requires-Python: >=3.13
6
6
  Description-Content-Type: text/markdown
@@ -0,0 +1,59 @@
1
+ -- Initial Fairchild schema
2
+
3
+ CREATE TABLE IF NOT EXISTS fairchild_jobs (
4
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
5
+
6
+ -- Task identification
7
+ task_name VARCHAR(255) NOT NULL,
8
+ queue VARCHAR(255) NOT NULL DEFAULT 'default',
9
+ args JSONB NOT NULL DEFAULT '{}',
10
+
11
+ -- Workflow membership
12
+ workflow_id UUID,
13
+ workflow_name VARCHAR(255),
14
+ job_key VARCHAR(255),
15
+ deps VARCHAR(255)[] DEFAULT '{}',
16
+
17
+ -- State
18
+ state VARCHAR(50) NOT NULL DEFAULT 'available',
19
+
20
+ -- Scheduling & priority
21
+ priority SMALLINT NOT NULL DEFAULT 5,
22
+ scheduled_at TIMESTAMPTZ NOT NULL DEFAULT now(),
23
+
24
+ -- Execution
25
+ attempted_at TIMESTAMPTZ,
26
+ completed_at TIMESTAMPTZ,
27
+ attempt INTEGER NOT NULL DEFAULT 0,
28
+ max_attempts INTEGER NOT NULL DEFAULT 3,
29
+
30
+ -- Results & errors
31
+ recorded JSONB,
32
+ errors JSONB DEFAULT '[]',
33
+
34
+ -- Metadata
35
+ tags VARCHAR(255)[] DEFAULT '{}',
36
+ meta JSONB DEFAULT '{}',
37
+
38
+ inserted_at TIMESTAMPTZ NOT NULL DEFAULT now(),
39
+ updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
40
+ );
41
+
42
+ -- Index for fetching available jobs from a queue
43
+ CREATE INDEX IF NOT EXISTS idx_fairchild_jobs_fetchable
44
+ ON fairchild_jobs (queue, state, priority, scheduled_at)
45
+ WHERE state = 'available';
46
+
47
+ -- Index for workflow lookups
48
+ CREATE INDEX IF NOT EXISTS idx_fairchild_jobs_workflow
49
+ ON fairchild_jobs (workflow_id, job_key)
50
+ WHERE workflow_id IS NOT NULL;
51
+
52
+ -- Index for finding jobs by state
53
+ CREATE INDEX IF NOT EXISTS idx_fairchild_jobs_state
54
+ ON fairchild_jobs (state);
55
+
56
+ -- Index for scheduled jobs that need to become available
57
+ CREATE INDEX IF NOT EXISTS idx_fairchild_jobs_scheduled
58
+ ON fairchild_jobs (scheduled_at)
59
+ WHERE state = 'scheduled';
@@ -0,0 +1,8 @@
1
+ -- Add parent_id column for spawned tasks (parent-child job relationships)
2
+
3
+ ALTER TABLE fairchild_jobs
4
+ ADD COLUMN IF NOT EXISTS parent_id UUID REFERENCES fairchild_jobs(id);
5
+
6
+ CREATE INDEX IF NOT EXISTS idx_fairchild_jobs_parent
7
+ ON fairchild_jobs (parent_id)
8
+ WHERE parent_id IS NOT NULL;
@@ -0,0 +1,9 @@
1
+ -- Remove workflow columns (replaced by parent-child job relationships)
2
+
3
+ -- Drop the workflow index first
4
+ DROP INDEX IF EXISTS idx_fairchild_jobs_workflow;
5
+
6
+ -- Remove workflow columns
7
+ ALTER TABLE fairchild_jobs DROP COLUMN IF EXISTS workflow_id;
8
+ ALTER TABLE fairchild_jobs DROP COLUMN IF EXISTS workflow_name;
9
+ ALTER TABLE fairchild_jobs DROP COLUMN IF EXISTS job_key;
@@ -0,0 +1,16 @@
1
+ -- Workers table to track active workers
2
+ CREATE TABLE IF NOT EXISTS fairchild_workers (
3
+ id UUID PRIMARY KEY,
4
+ hostname TEXT NOT NULL,
5
+ pid INTEGER NOT NULL,
6
+ queues JSONB NOT NULL DEFAULT '{}', -- {"queue_name": num_slots, ...}
7
+ active_jobs INTEGER NOT NULL DEFAULT 0,
8
+ state TEXT NOT NULL DEFAULT 'running', -- running, paused, stopped
9
+ started_at TIMESTAMPTZ NOT NULL DEFAULT now(),
10
+ last_heartbeat_at TIMESTAMPTZ NOT NULL DEFAULT now(),
11
+ paused_at TIMESTAMPTZ,
12
+ metadata JSONB DEFAULT '{}'
13
+ );
14
+
15
+ CREATE INDEX IF NOT EXISTS idx_fairchild_workers_state ON fairchild_workers(state);
16
+ CREATE INDEX IF NOT EXISTS idx_fairchild_workers_heartbeat ON fairchild_workers(last_heartbeat_at);
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fairchild
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: Workflow scheduling with PostgreSQL
5
5
  Requires-Python: >=3.13
6
6
  Description-Content-Type: text/markdown
@@ -19,6 +19,10 @@ fairchild.egg-info/requires.txt
19
19
  fairchild.egg-info/top_level.txt
20
20
  fairchild/db/__init__.py
21
21
  fairchild/db/migrations.py
22
+ fairchild/db/migrations/001_initial.sql
23
+ fairchild/db/migrations/002_add_parent_id.sql
24
+ fairchild/db/migrations/003_remove_workflows.sql
25
+ fairchild/db/migrations/004_add_workers.sql
22
26
  fairchild/templates/dashboard.html
23
27
  fairchild/templates/job.html
24
28
  tests/test_cli.py
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fairchild"
3
- version = "0.0.3"
3
+ version = "0.0.4"
4
4
  description = "Workflow scheduling with PostgreSQL"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -14,7 +14,7 @@ dependencies = [
14
14
  fairchild = "fairchild.cli:main"
15
15
 
16
16
  [tool.setuptools.package-data]
17
- fairchild = ["templates/*.html"]
17
+ fairchild = ["templates/*.html", "db/migrations/*.sql"]
18
18
 
19
19
  [project.optional-dependencies]
20
20
  dev = [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes