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

B 2117 windows group process #4168

Merged
merged 2 commits into from
Apr 19, 2018

Conversation

ninoles
Copy link
Contributor

@ninoles ninoles commented Apr 17, 2018

A followed up on GH-4153

@ninoles
Copy link
Contributor Author

ninoles commented Apr 17, 2018

BTW, here the job I used for testing:

job "com" {
  datacenters = ["dc1"]
  task "com" {
    driver = "raw_exec"
    config = {
      command = "C:\\WINDOWS\\py.exe"
      args = ["-c", "import subprocess; subprocess.run('nomad logs -f -job com')"]
    }
  }
}

Note that applications like notepad will not work since they don't answer to Ctrl-Break events.

@schmichael
Copy link
Member

Thanks @ninoles! There's a couple linter errors that I'll fixup post merge.

@schmichael schmichael merged commit d6de69b into hashicorp:master Apr 19, 2018
@ninoles
Copy link
Contributor Author

ninoles commented Apr 19, 2018

I just try the version you put in #4169 and it works, but not with the job I sent you (I was trying to give you an easier example than what I use for our software). Here a more complete example, that also work with GUI application (notepad here):

job "com" {
   datacenters = ["dc1"]

  task "com" {
    driver = "raw_exec"
    
    config = {
      command = "C:\\WINDOWS\\py.exe"
      args = ["local\\run.py"]
    }
    template {
        data = <<EOH
import subprocess
import time
import signal

proc = subprocess.Popen("notepad")
def kill(sig, frame):
    print("Killing %s with %r" % (proc, sig))
    try:
        proc.terminate()
    except OsError:
        pass
    
signal.signal(signal.SIGBREAK, kill)

try:
    while not proc.poll():
        time.sleep(1)
except KeyboardInterrupt:
    print("Keyboard interrupt received, killing notepad.")
    kill(0, 0)
    proc.wait()
print("Exiting")
EOH

  destination = "local/run.py"
    }
  }
}

@ninoles ninoles deleted the b-2117-windows-group-process branch April 19, 2018 19:36
@schmichael
Copy link
Member

@ninoles I deleted #4169 and merged this PR. Are you saying it doesn't work as expected? Here's an executable built from master 45d0c88

nomad-45d0c88fa-windows_amd64.zip

@ninoles
Copy link
Contributor Author

ninoles commented Apr 24, 2018

No, sorry, the previous job was a slight variation on one I was using internally, in my own setup (with other jobs running, etc.). The one above just work perfectly. My only problems now is how to make nomad ignore the IPv6 address that windows set on their default loopback, but that's another problem.

@github-actions
Copy link

github-actions bot commented Mar 5, 2023

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 Mar 5, 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.

None yet

2 participants