How medurubharath/application_blocking works
Project type and purpose
• This is a small, single-script, command-line tool (“chrome pro.py”) whose job is to automate creation and management of a Windows Task Scheduler task (“application_blocking”).
• It doesn’t include a frontend/backend split; it’s an open-source utility that drives the Windows Task Scheduler engine via Python.
File structure
• Top level:
• README.md – describes scheduler settings, triggers, actions
• chrome pro.py – the Python script that implements everything
• No subdirectories or separate modules; everything lives in one script.
• Likely uses a Windows-specific library (e.g., pywin32 or win32com) to talk to the Task Scheduler COM API.
README for additional insights
• The tool must:
• Set up daily triggers repeating every 5 minutes, indefinitely
• Register an action pointing to a Python executable and target script
• Configure settings (run on demand, force stop, parallel instances)
Components
a. Main components
• User / CLI – the person or automation invoking the Python script
• Python Runtime – executes chrome pro.py
• Scheduler Library – the Python module (pywin32/win32com) that wraps the COM interface
• Windows Task Scheduler Service – the OS component that stores and runs tasks
• Scheduled Task Instance – the child process launched by the scheduler (a Python process running the target action)
b. Relationships and interactions
1. User invokes chrome pro.py with appropriate arguments or config.
2. The script uses the Scheduler Library to construct a Task Definition object (General, Triggers, Actions, Settings).
3. The script registers or updates the task via the Task Scheduler Service’s COM API.
4. The Task Scheduler Service persists the task in its database.
5. On each trigger (daily, every 5 min), the service launches a new Python process running the specified action.
c. Architectural patterns / design principles
• CLI utility pattern
• External service integration (separation of concerns: script defines tasks, scheduler executes them)
• Idempotent task registration (script can be re-run to update settings)
d. Key technologies / libraries
• Python 3.x
• pywin32 or win32com.client
• Windows Task Scheduler COM interfaces
Diagramming recommendations
• CLI → Python Runtime (“execute chrome pro.py”)
• Script → Scheduler Library (“build Task Definition”)
• Scheduler Library → Task Scheduler Service (“RegisterTaskDefinition”)
• Task Scheduler Service → Scheduled Task Instance (“On Trigger: launch Python process”)
• Blue for your script components (CLI, Python Runtime, Scheduler Library)
• Green for OS service (Task Scheduler Service)
• Orange for runtime jobs (Scheduled Task Instance)
Essential details
• That the Task Scheduler Service persists definitions and later invokes the action on schedule.
• Parallel-instance capability by annotating the Scheduled Task Instance node with “multiple instances allowed.”