# Plan 2: PsiJ Pre-population & Account Data Enhancement

## Objective
Automatically select the most appropriate default queue (e.g., `debug`) when `queue_info` is collected and ensure that the `queue_info` plugin provides all necessary user accounts for submission.

## Implementation Steps

### 1. Enhance `queue_info` Backend for Accounts
- **File**: `src/radical/edge/queue_info.py`
- **Action**: Verify `_collect_allocations` returns all relevant accounts for the current user.
- **Action**: If the current Slurm association query is too restrictive, add `_collect_user_accounts` which might query `sacctmgr show user $USER format=Account`.
- **Action**: Ensure the return format is consistent: `{"accounts": ["acc1", "acc2"], ...}`.

### 2. Auto-Selection Logic in Explorer
- **File**: `examples/edge_explorer.html`
- **Action**: Update the `psij` population logic (triggered after `queue_info` fetch).
- **Action**: Implement a "best fit" search for the default queue:
    - Priority 1: Queue named `debug`.
    - Priority 2: Queue named `interactive`.
    - Priority 3: First available queue.
- **Action**: Auto-set the first available account from the fetched `allocations` list.

## Test Plan
1. **Account Verification**:
    - Run the `queue_info` plugin manually or via `BridgeClient` and ensure the list of accounts matches what `sacctmgr` shows for the current user.
2. **Pre-population Test**:
    - Load the explorer.
    - Click "Refresh" on the `Queue Info` page for an edge that has a `debug` partition.
    - Go to the `PsiJ Jobs` page.
    - Verify that the dropdown for "Queue" is automatically set to `debug`.
3. **Fallback Test**:
    - On a system without a `debug` queue, verify it selects the first available partition.
