jarvice

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2022 License: BSD-2-Clause-Views Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JarviceHpcConfigPath      = "/.config/jarvice-hpc/"
	JarviceHpcConfigFilename  = "config.json"
	JarviceHpcConfigFilePerms = 0600
)
View Source
const (
	// TODO: use application command specified by queue
	JarviceHpcCommand = "Batch"
	// XXX
	JarviceHpcGeometry    = "1280x720"
	JarviceHpcStaging     = false
	JarviceHpcCheckedout  = false
	JarviceHpcCommandName = "HpcJob"
)

Default constants

View Source
const JarviceHpcConfigEnv = "JARVICE_HPC_CONFIG"
View Source
const JobScriptArg = "PARSE_JOBSCRIPT"

Variables

This section is empty.

Functions

func ApiReq

func ApiReq(endpoint, api string, insecure bool,
	args url.Values) (body []byte, err error)

func CreateHelpErr

func CreateHelpErr() error

func GetOutboundIP

func GetOutboundIP() string

func HpcLive added in v0.0.4

func HpcLive(cluster string) (err error)

func HpcLogin

func HpcLogin(endpoint string, insecure bool, cluster, username, apikey,
	vault string) (err error)

func HpcVault

func HpcVault(vault string) (err error)

func IsYes

func IsYes(str string) bool

func ParseJobFlags

func ParseJobFlags(data interface{}, parser *flags.Parser,
	jobScriptParser *flags.Parser, args []string, override bool) error

func PreprocessArgs

func PreprocessArgs(args []string) ([]string, error)

func PrintTable

func PrintTable(table [][]string, line bool)

func ReadJarviceConfigTarget

func ReadJarviceConfigTarget() string

func WriteJarviceConfig

func WriteJarviceConfig(config JarviceConfig) error

func WriteJarviceConfigTarget

func WriteJarviceConfigTarget(target string) error

Types

type HpcReq

type HpcReq struct {
	JobEnvConfig string            `json:"hpc_job_env_config"`
	JobScript    string            `json:"hpc_job_script"`
	JobShell     string            `json:"hpc_job_shell"`
	Queue        string            `json:"hpc_queue"`
	Umask        int               `json:"hpc_umask"`
	Envs         map[string]string `json:"hpc_envs,omitempty"`
	Resources    map[string]string `json:"hpc_resources"`
}

type JarviceApiSubmission

type JarviceApiSubmission struct {
	Machine JarviceMachine `json:"machine"`
	Queue   string         `json:"queue"`
}

type JarviceApplication

type JarviceApplication struct {
	Command    string                 `json:"command"`
	Walltime   string                 `json:"walltime,omitempty"`
	Geometry   string                 `json:"geometry"`
	Parameters map[string]interface{} `json:"parameters,omitempty"`
}

JARVICE submission format

type JarviceCluster

type JarviceCluster struct {
	Endpoint string       `json:"jarvice_endpoint"`
	Insecure bool         `json:"jarvice_insecure"`
	Vault    string       `json:"jarvice_vault"`
	Creds    JarviceCreds `json:"jarvice_user"`
}

func GetClusterConfig

func GetClusterConfig() (cluster JarviceCluster, err error)

func (JarviceCluster) GetUrlCreds

func (c JarviceCluster) GetUrlCreds() url.Values

type JarviceConfig

type JarviceConfig map[string]JarviceCluster

func ReadJarviceConfig

func ReadJarviceConfig() (JarviceConfig, error)

type JarviceCreds

type JarviceCreds struct {
	Username string `json:"username"`
	Apikey   string `json:"apikey"`
}

type JarviceJob

type JarviceJob struct {
	Label         string               `json:"job_label"`
	User          string               `json:"job_owner_username"`
	Status        string               `json:"job_status"`
	SubmitTime    int                  `json:"job_submit_time"`
	StartTime     int                  `json:"job_start_time"`
	EndTime       int                  `json:"job_end_time"`
	ExitCode      int                  `json:"job_exitcode"`
	App           string               `json:"job_application"`
	ApiSubmission JarviceApiSubmission `json:"job_api_submission"`
}

type JarviceJobRequest

type JarviceJobRequest struct {
	App         string             `json:"app"`
	Staging     bool               `json:"staging"`
	Checkedout  bool               `json:"checkedout"`
	Application JarviceApplication `json:"application"`
	Machine     JarviceMachine     `json:"machine"`
	Vault       JarviceVault       `json:"vault"`
	JobLabel    string             `json:"job_label,omitempty"`
	User        JarviceCreds       `json:"user"`
	Hpc         HpcReq             `json:"hpc"`
	Licenses    *string            `json:"licenses,omitempty"`
	JobProject  *string            `json:"job_project,omitempty"`
}

type JarviceJobResponse

type JarviceJobResponse struct {
	Name   string `json:"name"`
	Number int    `json:"number"`
}

Return from API (jarvice/submit)

func JarviceSubmitJob

func JarviceSubmitJob(endpoint string, insecure bool, jobReq JarviceJobRequest) (JarviceJobResponse, error)

Submit job request to JARVICE API

type JarviceJobs

type JarviceJobs = map[int]JarviceJob

type JarviceMachine

type JarviceMachine struct {
	Type  string `json:"type"`
	Nodes int    `json:"nodes"`
}

type JarviceQueue

type JarviceQueue struct {
	Name           string `json:"name"`
	App            string `json:"app"`
	DefaultMachine string `json:"machine"`
	MachineScale   int    `json:"size"`
}

type JarviceQueues

type JarviceQueues = map[string]JarviceQueue

type JarviceVault

type JarviceVault struct {
	Name     string `json:"name"`
	ReadOnly bool   `json:"readonly"`
	Force    bool   `json:"force"`
}

type JobScript

type JobScript struct {
	Shell string `json:"hpc_shell"`
	// Args parsed from SBATCH directive
	Args   []string `json:"hpc_args"`
	Script []byte   `json:"hpc_script"`
}

XXX Data for HPC job script

#!/bin/bash #SBATCH --job-name=job_test # Job name #SBATCH --time=00:05:00 pwd; hostname; date

func ParseJobScript

func ParseJobScript(directive, filename string) (JobScript, error)

type JobSpec

type JobSpec struct {
	// Job environment variables
	SubmitDirectory string            `json:"hpc_submit_directory"`
	SubmitHost      string            `json:"hpc_submit_host"`
	QueueName       string            `json:"hpc_queue_name"`
	JobName         string            `json:"hpc_job_name"`
	UserEnv         map[string]string `json:"hpc_user_env"`

	Queue             string `json:"hpc_queue"`
	NodeCount         int    `json:"hpc_node_count"`
	CpuCount          int    `json:"hpc_cpu_count"`
	WallClockLimit    string `json:"hpc_wall_clock_limit"`
	OutputFile        string `json:"hpc_output_file"`
	ErrorFile         string `json:"hpc_error_file"`
	CopyEnvironment   string `json:"hpc_opy_environment"`
	EventNotification string `json:"hpc_event_notification"`
	EmailAddress      string `json:"hpc_email_address"`
	JobRestart        bool   `json:"hpc_job_restart"`
	WorkingDirectory  string `json:"hpc_working_directory"`
	Exclusive         bool   `json:"hpc_exclusive"`
	Memory            string `json:"hpc_memory"`
	ChargeAccount     string `json:"hpc_charge_account"`
	TasksPerNode      int    `json:"hpc_tasks_per_node"`
	CpusPerTask       int    `json:"hpc_cpus_per_task"`
	JobDependency     string `json:"hpc_job_dependency"`
	JobProject        string `json:"hpc_job_project"`
	GenericResources  string `json:"hpc_generic_resources"`
	Licenses          string `json:"hpc_licenses"`
	BeginTime         string `json:"hpc_begin_time"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL