Skip to content

Commit

Permalink
Merge pull request #46 from iron-io/add-label
Browse files Browse the repository at this point in the history
adds label field to task / schedules
  • Loading branch information
Reed Allman committed Nov 6, 2015
2 parents b8bd5cd + a1b22f0 commit 2bdc981
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ type QueueCmd struct {
delay *int
wait *bool
cluster *string
label *string

// payload
task worker.Task
Expand All @@ -150,6 +151,7 @@ type SchedCmd struct {
cluster *string
endAt *string // time.RubyTime
startAt *string // time.RubyTime
label *string

sched worker.Schedule
}
Expand Down Expand Up @@ -178,6 +180,7 @@ func (s *SchedCmd) Flags(args ...string) error {
s.endAt = s.flags.endAt()
s.startAt = s.flags.startAt()
s.cluster = s.flags.cluster()
s.label = s.flags.label()

err := s.flags.Parse(args)
if err != nil {
Expand Down Expand Up @@ -205,6 +208,7 @@ func (s *SchedCmd) Args() error {
Priority: priority,
RunTimes: s.runTimes,
Cluster: *s.cluster,
Label: *s.label,
}

payload := *s.payload
Expand Down Expand Up @@ -308,6 +312,7 @@ func (q *QueueCmd) Args() error {
Timeout: &timeout,
Delay: &delay,
Cluster: *q.cluster,
Label: *q.label,
}

return nil
Expand Down
4 changes: 4 additions & 0 deletions flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ func (wf *WorkerFlags) cluster() *string {
return wf.String("cluster", "", "optional: specify cluster to queue task on")
}

func (wf *WorkerFlags) label() *string {
return wf.String("label", "", "optional: specify label for a task")
}

func allowedSymbolsOnly(s string) error {
for _, runeValue := range s {
if !(runeValue == '/' || runeValue == '_' || runeValue == '-' || unicode.IsLetter(runeValue) || unicode.IsNumber(runeValue)) {
Expand Down

0 comments on commit 2bdc981

Please sign in to comment.