Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32832 > unrolled thread

interruptable process?

Started byEric Douglas <e.d.programmer@gmail.com>
First post2015-10-08 05:27 -0700
Last post2015-10-09 12:13 -0700
Articles 14 on this page of 34 — 4 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-08 05:27 -0700
    Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-08 09:50 -0400
      Re: interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-08 07:39 -0700
        Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-08 14:27 -0400
          Re: interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-08 11:58 -0700
            Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-08 15:10 -0400
            Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-08 15:22 -0400
              Re: interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-08 12:40 -0700
                Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-08 16:21 -0400
                  Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-08 16:55 -0400
                    Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-08 21:15 -0400
                      Re: interruptable process? Martin Gregorie <martin@address-in-sig.invalid> - 2015-10-09 09:41 +0000
                        Re: interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-09 05:12 -0700
                          Re: interruptable process? Martin Gregorie <martin@address-in-sig.invalid> - 2015-10-09 13:52 +0000
                            Re: interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-09 09:08 -0700
                              Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-09 12:43 -0400
                                Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-09 13:23 -0400
                          Re: interruptable process? Jan Burse <janburse@fastmail.fm> - 2015-10-09 18:26 +0200
                            Re: interruptable process? Jan Burse <janburse@fastmail.fm> - 2015-10-09 18:30 +0200
                              Re: interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-09 10:31 -0700
                                Re: interruptable process? Martin Gregorie <martin@address-in-sig.invalid> - 2015-10-09 23:13 +0000
                                  Re: interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-12 05:09 -0700
                            Re: interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-09 10:25 -0700
                              Re: interruptable process? Jan Burse <janburse@fastmail.fm> - 2015-10-09 20:04 +0200
                                Re: interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-09 11:23 -0700
                                  Re: interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-09 11:30 -0700
                        Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-09 08:38 -0400
                    Re: interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-09 05:18 -0700
                      Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-09 08:46 -0400
                        Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-09 08:59 -0400
                          Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-09 11:06 -0400
                            Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-09 13:54 -0400
                              Re: interruptable process? Jeff Higgins <jeff@invalid.invalid> - 2015-10-09 14:59 -0400
                                Re: interruptable process? Eric Douglas <e.d.programmer@gmail.com> - 2015-10-09 12:13 -0700

Page 2 of 2 — ← Prev page 1 [2]


#32867

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2015-10-09 23:13 +0000
Message-ID<mv9hml$opi$1@dont-email.me>
In reply to#32860
On Fri, 09 Oct 2015 10:31:56 -0700, Eric Douglas wrote:

> On Friday, October 9, 2015 at 12:30:19 PM UTC-4, Jan Burse wrote:
>> http://docs.oracle.com/javase/7/docs/api/java/lang/Process.html destroy
>> public abstract void destroy()
>> Kills the subprocess. The subprocess represented by this Process object
>> is forcibly terminated.
> 
> I tried the destroy method, it didn't work.  The java ProcessBuilder
> starts command Blender.exe with a -P that passes it a python script. 
> This line in the script apparently starts a second Blender.exe which
> actually does the rendering.  Only the first Blender task is destroyed.
> bpy.ops.render.render( write_still=True )
> 
> If this Java process is started from a cmd.exe window and we press ctrl
> + break on that window it does terminate the render.  This is what I
> hoped to emulate through code.  This ctrl + break command can only be
> executed at the server's physical console.  We cannot even sign in
> remotely to this server, it breaks the Blender program.

Does it work any better if you use Runtime.exec() rather than 
ProcessBuilder.start()? 

I'm asking because Runtime.exec() looks more like the C execl*() set of 
functions, which give you rather more control over the child process than 
the C system() function does.
 

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [next] | [standalone]


#32870

FromEric Douglas <e.d.programmer@gmail.com>
Date2015-10-12 05:09 -0700
Message-ID<1ef06b30-59cd-4175-ab45-67f6a5719885@googlegroups.com>
In reply to#32867
On Friday, October 9, 2015 at 7:15:49 PM UTC-4, Martin Gregorie wrote:
> Does it work any better if you use Runtime.exec() rather than 
> ProcessBuilder.start()? 

Yes, that is what I wrote in my last message.  I ended up using Runtime.getRuntime().exec() which returns the same Process instance as ProcessBuilder.start() but does recognize the taskkill command while the one from ProcessBuilder does not.

[toc] | [prev] | [next] | [standalone]


#32859

FromEric Douglas <e.d.programmer@gmail.com>
Date2015-10-09 10:25 -0700
Message-ID<17a0f493-8daf-43f8-bf5b-d4ca7b5ce3a8@googlegroups.com>
In reply to#32855
On Friday, October 9, 2015 at 12:26:54 PM UTC-4, Jan Burse wrote:
> kill -9 xx
> https://en.wikipedia.org/wiki/Kill_%28command%29

I'm not aware of any command called kill.  This is Windows not Unix.

[toc] | [prev] | [next] | [standalone]


#32862

FromJan Burse <janburse@fastmail.fm>
Date2015-10-09 20:04 +0200
Message-ID<mv8vjq$8qt$1@news.albasani.net>
In reply to#32859
Eric Douglas schrieb:
> On Friday, October 9, 2015 at 12:26:54 PM UTC-4, Jan Burse wrote:
>> >kill -9 xx
>> >https://en.wikipedia.org/wiki/Kill_%28command%29
> I'm not aware of any command called kill.  This is Windows not Unix.

https://en.wikipedia.org/wiki/Kill_%28command%29#Microsoft_Windows

[toc] | [prev] | [next] | [standalone]


#32863

FromEric Douglas <e.d.programmer@gmail.com>
Date2015-10-09 11:23 -0700
Message-ID<37c622d7-f423-468e-b9af-d2414cf2df57@googlegroups.com>
In reply to#32862
On Friday, October 9, 2015 at 2:04:52 PM UTC-4, Jan Burse wrote:
> https://en.wikipedia.org/wiki/Kill_%28command%29#Microsoft_Windows

Well that's curious.  I have never seen that, apparently never had to terminate a process this way before on Windows.  I have used kill on Unix but it didn't give us any other option.
Our Java process is starting Blender.exe.  In Task Manager this shows two processes titled 'Blender'.  If I type taskkill /F /im Blender.exe it does the same thing as the Java destroy and leaves the second one hanging which is actually doing the render process.  If I right click that in Task Manager and view properties it shows it's actually Blender-app.exe.  If I type taskkill /F /im Blender-app.exe it does terminate both processes, the first one apparently being just a monitor for the second one.
This should work from the Java to abort, though it sounds like an ugly way to do it, and I'll have to code in a path for it.  In the cmd.exe window I just typed the taskkill command and it just worked.  I tried it from a ProcessBuilder and it says "The system cannot find the file specified".

[toc] | [prev] | [next] | [standalone]


#32864

FromEric Douglas <e.d.programmer@gmail.com>
Date2015-10-09 11:30 -0700
Message-ID<dbf7264d-90ba-4fe5-b98b-d93e18e308fd@googlegroups.com>
In reply to#32863
On Friday, October 9, 2015 at 2:24:25 PM UTC-4, Eric Douglas wrote:
> This should work from the Java to abort, though it sounds like an ugly way to do it, and I'll have to code in a path for it.  In the cmd.exe window I just typed the taskkill command and it just worked.  I tried it from a ProcessBuilder and it says "The system cannot find the file specified".

So java.lang.ProcessBuilder is supposed to execute platform independent processes?  Runtime.getRuntime().exec() didn't have any trouble executing the same taskkill command.  This may not be the prettiest method but problem solved.

[toc] | [prev] | [next] | [standalone]


#32846

FromJeff Higgins <jeff@invalid.invalid>
Date2015-10-09 08:38 -0400
Message-ID<mv8cd0$4vf$1@dont-email.me>
In reply to#32843
On 10/09/2015 05:41 AM, Martin Gregorie wrote:
> On Thu, 08 Oct 2015 21:15:30 -0400, Jeff Higgins wrote:
>
>> On 10/08/2015 04:55 PM, Jeff Higgins wrote:
>>> On 10/08/2015 04:21 PM, Jeff Higgins wrote:
>>>
>>>>> I don't know if all this even makes sense or there's an easier way to
>>>>> start processes on a machine that can be aborted from another
>>>>> machine.
>>>>>
>>>>>
>>> I'm not really sure why Java platform anyway.
>>>
>>> <http://windowsitpro.com/powershell/break-your-batch-habit-and-move-
> powershell>
>>>
>>>
>>> <https://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx>
>>>
>> If using the OS services to kill a running blender instance seems
>> drastic.
>>
>> Maybe you can finesse it with some python scripting.
>> <http://www.blender.org/api/blender_python_api_2_76_1/
> bpy.app.handlers.html>
>>
>> You'll still want a way to communicate.
>> Maybe Jetty or Tomcat.
>>
> Seems heavy.

I agree. Which is why I pointed at Powershell. It doesn't make sense to
me to be running this with a JVM, all Java has is ProcessBuilder.

Two cooperating Windows services, a Blender Job queue service, and a
Blender render service seems the simplest and most controllable.
Well, plus an app for users to request and track job tickets.
>
> How about two user threads? One to process entries on a queue of blender
> requests and the other to monitor a socket for blender requests and
> action them [add/delete queue entries and, on request, kill the current
> blender process].
>
> Question for the OP: it appears that any user can add blender tasks to
> the queue, but can any user kill the current blender task regardless of
> who submitted it?
>
It's bad enough that an administrator can shut down my jobs, now you
want to let Bob do it?

[toc] | [prev] | [next] | [standalone]


#32845

FromEric Douglas <e.d.programmer@gmail.com>
Date2015-10-09 05:18 -0700
Message-ID<76a9ab93-84d9-4b4d-88bd-a612c8ca91e1@googlegroups.com>
In reply to#32841
On Thursday, October 8, 2015 at 4:56:06 PM UTC-4, Jeff Higgins wrote:
> I'm not really sure why Java platform anyway.
> 
> <http://windowsitpro.com/powershell/break-your-batch-habit-and-move-powershell>
> 
> <https://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx>

I have written plenty of batch files over the years.  I'm working on this process manager in Java because I know a lot of Java and it was already written in Java.  The one part it really needs now that it doesn't have is an option to remotely terminate.  I've actually never used powershell.

[toc] | [prev] | [next] | [standalone]


#32847

FromJeff Higgins <jeff@invalid.invalid>
Date2015-10-09 08:46 -0400
Message-ID<mv8crl$6s4$1@dont-email.me>
In reply to#32845
On 10/09/2015 08:18 AM, Eric Douglas wrote:
> On Thursday, October 8, 2015 at 4:56:06 PM UTC-4, Jeff Higgins wrote:
>> I'm not really sure why Java platform anyway.
>>
>> <http://windowsitpro.com/powershell/break-your-batch-habit-and-move-powershell>
>>
>> <https://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx>
>
> I have written plenty of batch files over the years.  I'm working on this process manager in Java because I know a lot of Java and it was already written in Java.  The one part it really needs now that it doesn't have is an option to remotely terminate.  I've actually never used powershell.
>
Then I'd consider scripting the render jobs in Windows, and simply call
StartARenderJob.script, and StopARenderJob.script from Java.

Just my opinion.

[toc] | [prev] | [next] | [standalone]


#32848

FromJeff Higgins <jeff@invalid.invalid>
Date2015-10-09 08:59 -0400
Message-ID<mv8dk0$8so$1@dont-email.me>
In reply to#32847
On 10/09/2015 08:46 AM, Jeff Higgins wrote:
> On 10/09/2015 08:18 AM, Eric Douglas wrote:
>> On Thursday, October 8, 2015 at 4:56:06 PM UTC-4, Jeff Higgins wrote:
>>> I'm not really sure why Java platform anyway.
>>>
>>> <http://windowsitpro.com/powershell/break-your-batch-habit-and-move-powershell>
>>>
>>>
>>> <https://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx>
>>
>> I have written plenty of batch files over the years.  I'm working on
>> this process manager in Java because I know a lot of Java and it was
>> already written in Java.  The one part it really needs now that it
>> doesn't have is an option to remotely terminate.  I've actually never
>> used powershell.
>>
> Then I'd consider scripting the render jobs in Windows, and simply call
> StartARenderJob.script, and StopARenderJob.script from Java.
>
> Just my opinion.
>
After posting this I googled:
"powershell execute app when file dropped in folder"

[toc] | [prev] | [next] | [standalone]


#32851

FromJeff Higgins <jeff@invalid.invalid>
Date2015-10-09 11:06 -0400
Message-ID<mv8l3r$98c$1@dont-email.me>
In reply to#32848
On 10/09/2015 08:59 AM, Jeff Higgins wrote:
>>
>> Just my opinion.
>>
> After posting this I googled:
> "powershell execute app when file dropped in folder"
>
I'm sure everyone here has heard enough of my opinion, but

Powershell is a shell built on .net. .net is a VM much like
JVM. Unlike JVM, .net standard library includes all the stuff needed
to script Windows. So, JVM is much less powerful than .net in scripting
Windows. Just as easy to script in .net as Java platform. But I get your
point that you're just tweaking an existing and working script. However,
some several short hours - including learning curve - and you could
have a much more performant, safe script.

I don't have anything against Java. Just the wrong tool for the job.

[toc] | [prev] | [next] | [standalone]


#32861

FromJeff Higgins <jeff@invalid.invalid>
Date2015-10-09 13:54 -0400
Message-ID<mv8ute$h9j$1@dont-email.me>
In reply to#32851
On 10/09/2015 11:06 AM, Jeff Higgins wrote:
> On 10/09/2015 08:59 AM, Jeff Higgins wrote:
>>>
>>> Just my opinion.
>>>
>> After posting this I googled:
>> "powershell execute app when file dropped in folder"
>>
> I'm sure everyone here has heard enough of my opinion, but
>
> Powershell is a shell built on .net. .net is a VM much like
> JVM. Unlike JVM, .net standard library includes all the stuff needed
> to script Windows. So, JVM is much less powerful than .net in scripting
> Windows. Just as easy to script in .net as Java platform. But I get your
> point that you're just tweaking an existing and working script. However,
> some several short hours - including learning curve - and you could
> have a much more performant, safe script.
>
> I don't have anything against Java. Just the wrong tool for the job.
>
>
eternal-september carries microsoft.public.windows.powershell
not high volume but looks like OT questions are answered

[toc] | [prev] | [next] | [standalone]


#32865

FromJeff Higgins <jeff@invalid.invalid>
Date2015-10-09 14:59 -0400
Message-ID<mv92n0$2a0$1@dont-email.me>
In reply to#32861
On 10/09/2015 01:54 PM, Jeff Higgins wrote:
> On 10/09/2015 11:06 AM, Jeff Higgins wrote:
>> On 10/09/2015 08:59 AM, Jeff Higgins wrote:
>>>>
>>>> Just my opinion.
>>>>
>>> After posting this I googled:
>>> "powershell execute app when file dropped in folder"
>>>
>> I'm sure everyone here has heard enough of my opinion, but
>>
>> Powershell is a shell built on .net. .net is a VM much like
>> JVM. Unlike JVM, .net standard library includes all the stuff needed
>> to script Windows. So, JVM is much less powerful than .net in scripting
>> Windows. Just as easy to script in .net as Java platform. But I get your
>> point that you're just tweaking an existing and working script. However,
>> some several short hours - including learning curve - and you could
>> have a much more performant, safe script.
>>
>> I don't have anything against Java. Just the wrong tool for the job.
>>
>>
> eternal-september carries microsoft.public.windows.powershell
> not high volume but looks like OT questions are answered
>
>
Doom as a tool for system administration
<http://www.cs.unm.edu/~dlchao/flake/doom/>

[toc] | [prev] | [next] | [standalone]


#32866

FromEric Douglas <e.d.programmer@gmail.com>
Date2015-10-09 12:13 -0700
Message-ID<5aebd164-2ad0-4b4e-b80c-aa289d849d09@googlegroups.com>
In reply to#32865
On Friday, October 9, 2015 at 2:59:55 PM UTC-4, Jeff Higgins wrote:
> Doom as a tool for system administration
> <http://www.cs.unm.edu/~dlchao/flake/doom/>

rofl

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.java.programmer


csiph-web