Skip to content

Conversation

@Kobzol
Copy link
Member

@Kobzol Kobzol commented Jun 13, 2025

Summary

Implements the hq job workdir and hq task workdir commands requested in #644.

These commands provide a convenient way to quickly retrieve working directory information for jobs and tasks without parsing verbose info command output.

Features

hq job workdir <selector>

  • Displays working directories for selected job(s)
  • Shows both submission directories and task working directories
  • Supports all job selector formats (ID, range, "last", "all")
  • Deduplicates and sorts working directories

hq task workdir <job_selector> <task_selector>

  • Displays working directories for specific tasks within a job
  • Shows resolved task-specific working directory paths
  • Supports task ID arrays and ranges
  • Job selector supports "last" and specific job IDs

Output Formats

Both commands support:

  • CLI: Clean, hierarchical display with job/task headers
  • JSON: Structured output for programmatic access
  • Quiet: Silent operation for scripting

Examples

# Display workdir for job 1
hq job workdir 1

# Display workdir for multiple jobs
hq job workdir 1-5

# Display workdir for last job
hq job workdir last

# Display workdir for specific tasks
hq task workdir 1 2-4

# JSON output
hq job workdir 1 --output-mode json

Implementation Details

  • Leverages existing resolve_task_paths functionality
  • Follows HyperQueue's established CLI patterns
  • Integrates seamlessly with existing job/task selection mechanisms
  • Maintains consistency with other job/task commands

Test Coverage

Comprehensive test suite covering:

  • Core functionality for both commands
  • All output formats (CLI/JSON/quiet)
  • Error handling and edge cases
  • Integration with existing workflows
  • Performance with multiple jobs/tasks

All tests pass successfully.

Fixes

Closes #644

🤖 Generated with Claude Code

@Kobzol Kobzol requested a review from spirali June 13, 2025 10:02
Implements the task workdir command requested in issue It4innovations#644. The command
displays working directories for selected tasks within a specific job.

Features:
- CLI output showing task-specific working directories
- JSON output with task_id -> workdir mapping
- Quiet output mode support
- Supports task ID arrays and ranges
- Job selector supports "last" and specific job IDs
- Resolves task-specific working directory paths
- Integrates with existing task selection mechanisms

Usage:
- hq task workdir <job_selector> <task_selector>
- hq task workdir 1 2
- hq task workdir last 1-5
- hq task workdir 2 1,3,5

The implementation reuses the existing task path resolution system to
provide accurate working directory information for individual tasks,
complementing the job-level workdir command.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Kobzol Kobzol force-pushed the feature/add-workdir-commands branch from c41613d to a7ee93e Compare June 13, 2025 11:19
Kobzol added 3 commits June 13, 2025 13:43
Remove unused imports and variables in test files
Remove unused variable assignment
Auto-format Python test files according to project standards
@spirali
Copy link
Collaborator

spirali commented Jun 23, 2025

The implementation looks good, but UX seems little bit weird.

  • Why it is called workdir and not submit dir? This is the most confusing thing for me. Was the original idea behind Add command for displaying the workdir of a job/task #644 really to print submit dir?
  • Why we need a separate command and not just add it into a job info?
  • The implementation does not work for waiting tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add command for displaying the workdir of a job/task

2 participants