Documentation
¶
Index ¶
Constants ¶
const (
DefaultPort = ":3939"
)
this is the default port assign to the odin engine
Variables ¶
var DeployCmd = &cobra.Command{ Use: "deploy", Aliases: []string{"add", "dep"}, Short: "deploy a job created by user", Long: `This subcommand deploys a job created by the user`, Run: func(cmd *cobra.Command, args []string) { deployJob(cmd, args) }, }
DeployCmd is used to define the metadata and run operation for this command
var DescribeCmd = &cobra.Command{ Use: "describe", Aliases: []string{"desc"}, Short: "describe a running Odin job", Long: `This subcommand will describe a running Odin job created by the user`, Run: func(cmd *cobra.Command, args []string) { id, _ := cmd.Flags().GetString("id") port, _ := cmd.Flags().GetString("port") if port == "" { port = DefaultPort } describeJob(id, port) }, }
DescribeCmd is used to define the metadata and run operation for this command
var ExecuteCmd = &cobra.Command{ Use: "execute", Aliases: []string{"exec"}, Short: "execute a job created by user", Long: `This subcommand executes a job created by the user`, Run: func(cmd *cobra.Command, args []string) { port, _ := cmd.Flags().GetString("port") if port == "" { port = DefaultPort } executeJob(cmd, args, port) }, }
ExecuteCmd is used to define the metadata and run operation for this command
var GenerateCmd = &cobra.Command{ Use: "generate ", Aliases: []string{"gen"}, Short: "creates config files for an Odin job", Long: `This subcommand creates config files for an Odin job`, Run: func(cmd *cobra.Command, args []string) { generateJob(cmd, args) }, }
GenerateCmd is used to define the metadata and run operation for this command
var LinkCmd = &cobra.Command{ Use: "link", Short: "links the user's current Odin jobs", Long: `This subcommand links the user's current Odin jobs`, Run: func(cmd *cobra.Command, args []string) { from, _ := cmd.Flags().GetString("from") to, _ := cmd.Flags().GetString("to") port, _ := cmd.Flags().GetString("port") if port == "" { port = DefaultPort } linkJob(from, to, port) }, }
LinkCmd is used to define metadata and run operation for this command
var ListCmd = &cobra.Command{ Use: "list", Aliases: []string{"ls"}, Short: "lists the user's current Odin jobs", Long: `This subcommand lists the user's current Odin jobs`, Run: func(cmd *cobra.Command, args []string) { port, _ := cmd.Flags().GetString("port") if port == "" { port = DefaultPort } listJob(port) }, }
ListCmd is used to define the metadata and run operation for this command
var LogCmd = &cobra.Command{ Use: "log", Short: "show metrics and logs associated with Odin jobs", Long: `This subcommand will show metrics and logs associated with Odin jobs`, Run: func(cmd *cobra.Command, args []string) { id, _ := cmd.Flags().GetString("id") port, _ := cmd.Flags().GetString("port") if port == "" { port = DefaultPort } logJob(id, port) }, }
LogCmd is used to define the metadata and run operation for this command
var ModifyCmd = &cobra.Command{ Use: "modify", Aliases: []string{"mod"}, Short: "change details about an Odin job in-place", Long: `This subcommand change details about an Odin job in-place`, Run: func(cmd *cobra.Command, args []string) { id, _ := cmd.Flags().GetString("id") name, _ := cmd.Flags().GetString("name") desc, _ := cmd.Flags().GetString("description") schedule, _ := cmd.Flags().GetString("schedule") port, _ := cmd.Flags().GetString("port") if port == "" { port = DefaultPort } modifyJob(id, name, desc, schedule, port) }, }
ModifyCmd is used to define the metadata and run operation for this command
var NodesCmd = &cobra.Command{ Use: "nodes [add|get]", Short: "interacts with odin engine nodes", Long: `This subcommand interacts with odin engine nodes`, Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 { cmd.Help() os.Exit(0) } switch args[0] { case "get": getNodesJob() case "add": name, _ := cmd.Flags().GetString("name") http, _ := cmd.Flags().GetString("addr") raft, _ := cmd.Flags().GetString("raft") if name == "" || http == "" || raft == "" { fmt.Println("You must supply values for:\n - The name of the new node (e.g -n worker1)\n - The address of the new node (e.g -a :39391)\n - The raft address of the new node (e.g -r :12001)") } else { addNodesJob(name, http, raft) } } }, }
NodesCmd is used to define the metadata and run operations for this command
var RecoverCmd = &cobra.Command{ Use: "recover", Aliases: []string{"ls"}, Short: "recovers files from a specific Odin job", Long: `This subcommand recovers files from a specific Odin job`, Run: func(cmd *cobra.Command, args []string) { id, _ := cmd.Flags().GetString("id") src := "/etc/odin/jobs/" + id dest, _ := os.Getwd() recoverJob(src, dest) }, }
RecoverCmd is used to define the metadata and run operation for this command
var RemoveCmd = &cobra.Command{ Use: "remove", Aliases: []string{"rm"}, Short: "removes a user's job by ID", Long: `This subcommand remove a user's job by ID`, Run: func(cmd *cobra.Command, args []string) { id, _ := cmd.Flags().GetString("id") port, _ := cmd.Flags().GetString("port") if port == "" { port = DefaultPort } removeJob(id, port) }, }
RemoveCmd is used to define the metadata and run operation for this command
var RootCmd = &cobra.Command{
Use: "odin",
Short: "orchestrate your jobs",
Long: `orchestrate your jobs for periodic execution`,
}
RootCmd is used to define the metadata and run operation for the base command
var StatsCmd = &cobra.Command{ Use: "stats", Short: "return the stats of an Odin job", Long: `This subcommand will return the stats of an Odin job`, Run: func(cmd *cobra.Command, args []string) { id, _ := cmd.Flags().GetString("id") port, _ := cmd.Flags().GetString("port") if port == "" { port = DefaultPort } statsJob(id, port) }, }
StatsCmd is used to define the metadata and run operation for this command
var UnlinkCmd = &cobra.Command{ Use: "unlink", Short: "unlinks the user's current Odin jobs", Long: `This subcommand unlinks the user's current Odin jobs`, Run: func(cmd *cobra.Command, args []string) { from, _ := cmd.Flags().GetString("from") to, _ := cmd.Flags().GetString("to") port, _ := cmd.Flags().GetString("port") if port == "" { port = DefaultPort } unlinkJob(from, to, port) }, }
UnlinkCmd is used to define the metadata and run operation for this command
Functions ¶
Types ¶
type Config ¶
type Config struct { Provider ProviderType `yaml:"provider"` Job JobType `yaml:"job"` }
Config is a type to tbe used for accessing config information
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data is used to export an error type
type JobType ¶
type JobType struct { ID string `yaml:"id"` Name string `yaml:"name"` Description string `yaml:"description"` Language string `yaml:"language"` File string `yaml:"file"` Schedule string `yaml:"schedule"` }
JobType is a type to tbe used for accessing job information in the config
type NewJob ¶
type NewJob struct { ID string `yaml:"id"` UID string `yaml:"uid"` GID string `yaml:"gid"` Name string `yaml:"name"` Description string `yaml:"description"` Language string `yaml:"language"` File string `yaml:"file"` Stats string `yaml:"stats"` Schedule string `yaml:"schedule"` }
NewJob is a type to tbe used for accessing job information
type ProviderType ¶
ProviderType is a type to tbe used for accessing provider information in the config