Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run / Stop commands #74

Merged
merged 38 commits into from
Sep 22, 2015
Merged

Run / Stop commands #74

merged 38 commits into from
Sep 22, 2015

Conversation

ryanuber
Copy link
Member

This PR has the new run and stop commands, as well as the eval-monitor command. There is a small state monitor that we use in all of these commands to watch what Nomad does once the commands are issued. You can optionally detach immediately using the -detach option for run or stop.

I've included docs and tests for everything so far, all suggestions for the UX welcome.

@ryanuber ryanuber changed the title F run Run / Stop commands Sep 21, 2015
// convertJob is used to take a *structs.Job and convert it to an *api.Job.
// This function is just a hammer and probably needs to be revisited.
func convertJob(in *structs.Job) (*api.Job, error) {
var apiJob *api.Job
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mapstructure maybe cleaner for this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did look at mapstructure for this but it seemed like I still needed to first convert to a map[string]interface{}, then from that to the *api.Job. Maybe there's something I'm missing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanuber Take a look here: http://godoc.org/github.com/mitchellh/mapstructure#Decode
It is interface{} to interface{}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... PHP mode isn't working.

package main

import "github.com/mitchellh/mapstructure"

type x struct {
    ID string
}

type y struct {
    ID string
}

func main() {
    in := &x{"hi"}
    out := new(y)
    if err := mapstructure.Decode(in, out); err != nil {
        println(err.Error())
        return
    }
}
$ go run test.go 
'' expected a map, got 'struct'

The reason I was thinking a map was required was because of these comments.

/cc @mitchellh

@armon
Copy link
Member

armon commented Sep 21, 2015

Left some UX feedback, but LGTM

@ryanuber
Copy link
Member Author

Great feedback, will get these addressed!

@ryanuber ryanuber force-pushed the f-run branch 2 times, most recently from 47f542c to 5a36ace Compare September 22, 2015 17:34
armon added a commit that referenced this pull request Sep 22, 2015
@armon armon merged commit d25677c into master Sep 22, 2015
@armon
Copy link
Member

armon commented Sep 22, 2015

BOOM

@cbednarski cbednarski deleted the f-run branch September 22, 2015 23:20
schmichael pushed a commit that referenced this pull request Jan 30, 2020
benbuzbee pushed a commit to benbuzbee/nomad that referenced this pull request Jul 21, 2022
benbuzbee pushed a commit to benbuzbee/nomad that referenced this pull request Jul 21, 2022
allow a node to vote for the current leader, fixes hashicorp#74
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants