Skip to content

feat: Add support to create jobs from the CLI #196

Closed
@tty47

Description

@tty47

Add create command to jobs CLI

Description

Currently, the CLI's jobs command only supports list and get operations. We need to add support for creating jobs using a JSON configuration file, similar to how the infrastructure creation works.

Current Behavior

  • The CLI only supports jobs list and jobs get commands
  • Attempting to use jobs create -f create_job.json results in an error

Proposed Behavior

Add a new subcommand create to the jobs command that:

  • Accepts a JSON file through the -f or --file flag
  • Validates the JSON input against the job schema
  • Creates a new job through the API client
  • Returns the created job information

Technical Details

CLI Command Structure

talis-cli jobs create [-f|--file] <json-file>

Required Changes

  1. Add new createJobCmd in cmd/cli/commands/jobs.go
  2. Add JSON schema validation for job creation
  3. Implement job creation through the API client
  4. Add proper error handling and user feedback

Example JSON Schema

{
    "name": "talis-cli",
    "project_name": "talis-1",
    "job_name": "talis-cli",
    "owner_id": 1,
    "instances": [
        {
            "name": "test-hostname",
            "provider": "do",
            "number_of_instances": 1,
            "provision": true,
            "region": "nyc1",
            "size": "s-1vcpu-1gb",
            "image": "ubuntu-22-04-x64",
            "tags": ["talis", "dev", "testing"],
            "ssh_key_name": "<ssh-key-name>",
            "volumes": [
                {
                    "name": "talis-volume",
                    "size_gb": 15,
                    "mount_point": "/mnt/data"
                }
            ]
        }
    ]
}

Acceptance Criteria

  • New create subcommand is added to the jobs command
    Command accepts a JSON file through the -f or --file flag
    JSON input is properly validated
    Job is created through the API client
    Appropriate success/error messages are displayed
    Documentation is updated to include the new command
    Tests are added for the new functionality

Related

  • Follows the same pattern as infrastructure creation command
  • Should integrate with existing job management API endpoints

Labels

  • enhancement
  • cli
  • jobs

Activity

added this to the Talis MVP milestone on Apr 15, 2025
added theissue type on Apr 15, 2025
MSevey

MSevey commented on Apr 15, 2025

@MSevey
Member

Quasi handled/references here: #190

my PR will either create it because I need it for testing.
or we will change it to the project create.
Either way, I'm already tracking it.

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    feat: Add support to create jobs from the CLI · Issue #196 · celestiaorg/talis