# medurubharath/application_blocking architecture

> Architecture diagram of the GitHub repository medurubharath/application_blocking, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/medurubharath/application_blocking
- Repository: https://github.com/medurubharath/application_blocking

## Overview

##### 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.”

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Script Components"
        direction TB
        User["User / CLI"]:::script
        PythonRuntime["Python Runtime"]:::script
        SchedulerLibrary["Scheduler Library<br/>(pywin32/win32com)"]:::script
        TaskDefinition["Task Definition:<br/>• General<br/>• Triggers<br/>• Actions<br/>• Settings"]:::doc
    end

    TaskSchedulerService["Windows Task<br/>Scheduler Service"]:::service

    ScheduledTaskInstance["Scheduled Task Instance<br/>(multiple instances allowed)"]:::job

    ProjectDoc["Project Documentation"]:::doc

    User -->|execute chrome pro.py| PythonRuntime
    PythonRuntime -->|build Task Definition| SchedulerLibrary
    SchedulerLibrary -->|defines Task Definition| TaskDefinition
    SchedulerLibrary -->|"RegisterTaskDefinition()"| TaskSchedulerService
    TaskSchedulerService -->|persists definition| TaskDefinition
    TaskSchedulerService -->|"On Trigger:<br/>launch Python process"| ScheduledTaskInstance

    click User "https://github.com/medurubharath/application_blocking/blob/master/chrome pro.py"
    click PythonRuntime "https://github.com/medurubharath/application_blocking/blob/master/chrome pro.py"
    click SchedulerLibrary "https://github.com/medurubharath/application_blocking/blob/master/chrome pro.py"
    click TaskSchedulerService "https://github.com/medurubharath/application_blocking/blob/master/chrome pro.py"
    click TaskDefinition "https://github.com/medurubharath/application_blocking/blob/master/README.md"
    click ProjectDoc "https://github.com/medurubharath/application_blocking/blob/master/README.md"

    classDef script fill:#D0E8FF,stroke:#0066CC,color:#003366,stroke-width:2px;
    classDef service fill:#DFF2D8,stroke:#3C763D,color:#336633,stroke-width:2px;
    classDef job fill:#FFE5CC,stroke:#CC6600,color:#993300,stroke-width:2px;
    classDef doc fill:#F2F2F2,stroke:#999999,color:#666666,stroke-width:1px,stroke-dasharray: 5 5;
```
