Re: [racket-users] implementing make in racket

2017-02-02 Thread Matthias Felleisen

(And you also want to catch all exns at that points and put them into ch. But I 
suspect you’d have known.)


> On Feb 2, 2017, at 9:11 AM, Jay McCarthy  wrote:
> 
> I would do something like:
> 
> (define ch (make-channel))
> (submit-job! jq (lambda () (define ans ...) (channel-put ch ans)))
> (channel-get ch ans)
> 
> This will synchronously wait for the job to finish. Presumably you'd
> do this when you already started up the workers and from a context
> where you have a lot of jobs running.
> 
> Jay
> 
> 
> 
> On Wed, Feb 1, 2017 at 2:21 PM, Dan Liebgold
>  wrote:
>> On Wednesday, November 30, 2016 at 10:38:05 AM UTC-8, Jay McCarthy wrote:
>>> The typed-racket code returns a value from the job, whereas this code
>>> assumes the job is fully self-contained. Perhaps job-queue should
>>> protect itself from job exceptions.
>>> 
>> 
>> BTW, how would you recommend returning a value from a job in job-queue?
>> 
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> 
> -- 
> Jay McCarthy
> Associate Professor
> PLT @ CS @ UMass Lowell
> http://jeapostrophe.github.io
> 
>   "Wherefore, be not weary in well-doing,
>  for ye are laying the foundation of a great work.
> And out of small things proceedeth that which is great."
>  - D&C 64:33
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2017-02-02 Thread Jay McCarthy
I would do something like:

(define ch (make-channel))
(submit-job! jq (lambda () (define ans ...) (channel-put ch ans)))
(channel-get ch ans)

This will synchronously wait for the job to finish. Presumably you'd
do this when you already started up the workers and from a context
where you have a lot of jobs running.

Jay



On Wed, Feb 1, 2017 at 2:21 PM, Dan Liebgold
 wrote:
> On Wednesday, November 30, 2016 at 10:38:05 AM UTC-8, Jay McCarthy wrote:
>> The typed-racket code returns a value from the job, whereas this code
>> assumes the job is fully self-contained. Perhaps job-queue should
>> protect itself from job exceptions.
>>
>
> BTW, how would you recommend returning a value from a job in job-queue?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D&C 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2017-02-01 Thread Dan Liebgold
On Wednesday, November 30, 2016 at 10:38:05 AM UTC-8, Jay McCarthy wrote:
> The typed-racket code returns a value from the job, whereas this code
> assumes the job is fully self-contained. Perhaps job-queue should
> protect itself from job exceptions.
> 

BTW, how would you recommend returning a value from a job in job-queue?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2016-11-30 Thread Dan Liebgold
On Wednesday, November 30, 2016 at 1:49:04 PM UTC-8, Jay McCarthy wrote:
> I just pushed a fix for this, btw.
> 
> 

Awesome, thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2016-11-30 Thread Jay McCarthy
I just pushed a fix for this, btw.

Jay

On Wed, Nov 30, 2016 at 2:15 PM, Dan Liebgold 
wrote:

> On Wednesday, November 30, 2016 at 10:38:05 AM UTC-8, Jay McCarthy wrote:
> > The typed-racket code returns a value from the job, whereas this code
> > assumes the job is fully self-contained. Perhaps job-queue should
> > protect itself from job exceptions.
> >
>
> Probably a good idea. I got confused working on my thunk... I'm spawning a
> subprocess that errors out.  I was using an asynchronous spawn
> (process/ports) and it caused a silent hang in (stop-job-queue! jq). I
> switched to system* for other reasons and since that is synchronous is
> handles the exception differently such that it never escapes my thunk ...
> so things work.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D&C 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2016-11-30 Thread Dan Liebgold
On Wednesday, November 30, 2016 at 10:38:05 AM UTC-8, Jay McCarthy wrote:
> The typed-racket code returns a value from the job, whereas this code
> assumes the job is fully self-contained. Perhaps job-queue should
> protect itself from job exceptions.
> 

Probably a good idea. I got confused working on my thunk... I'm spawning a 
subprocess that errors out.  I was using an asynchronous spawn (process/ports) 
and it caused a silent hang in (stop-job-queue! jq). I switched to system* for 
other reasons and since that is synchronous is handles the exception 
differently such that it never escapes my thunk ... so things work.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2016-11-30 Thread Jay McCarthy
The typed-racket code returns a value from the job, whereas this code
assumes the job is fully self-contained. Perhaps job-queue should
protect itself from job exceptions.

On Wed, Nov 30, 2016 at 1:30 PM, Dan Liebgold
 wrote:
> On Tuesday, November 29, 2016 at 6:30:08 PM UTC-8, David K. Storrs wrote:
>>
>> Can you simply catch it and handle it inside the thunk?
>>
>
> That's probably best. I was looking at the machinery to serialize exceptions 
> in type racket* and thinking I needed that
>
>
> *: 
> https://github.com/racket/typed-racket/blob/master/typed-racket-test/send-places.rkt
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D&C 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2016-11-30 Thread Dan Liebgold
On Tuesday, November 29, 2016 at 6:30:08 PM UTC-8, David K. Storrs wrote:
> 
> Can you simply catch it and handle it inside the thunk?
>  

That's probably best. I was looking at the machinery to serialize exceptions in 
type racket* and thinking I needed that


*: 
https://github.com/racket/typed-racket/blob/master/typed-racket-test/send-places.rkt

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2016-11-29 Thread David Storrs
On Tue, Nov 29, 2016 at 4:22 PM, Dan Liebgold 
wrote:

> On Tuesday, November 29, 2016 at 3:32:48 PM UTC-8, Jay McCarthy wrote:
> > Wow, that's a lame error that has been there for a LONG time. I just
> > pushed a fix.
> >
>
> Got it.
>
> Any advice for how to handle when a job thunk raises an exception?
> Currently (stop-job-queue! jq) waits forever...
>
>
Can you simply catch it and handle it inside the thunk?


> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2016-11-29 Thread Dan Liebgold
On Tuesday, November 29, 2016 at 3:32:48 PM UTC-8, Jay McCarthy wrote:
> Wow, that's a lame error that has been there for a LONG time. I just
> pushed a fix.
> 

Got it.

Any advice for how to handle when a job thunk raises an exception?  Currently 
(stop-job-queue! jq) waits forever...

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2016-11-29 Thread Jay McCarthy
Wow, that's a lame error that has been there for a LONG time. I just
pushed a fix.

On Tue, Nov 29, 2016 at 6:15 PM, Dan Liebgold
 wrote:
> On Tuesday, November 29, 2016 at 12:23:32 PM UTC-8, Jay McCarthy wrote:
>> DrDr uses job-queue for a similar process
>>
>> http://docs.racket-lang.org/job-queue/index.html
>>
>
> Looks promising. However, the docs say that stop-job-queue! will block until 
> jobs are done... and this code doesn't wait: http://pasterack.org/pastes/29869
>
> Did I miss something?
>
> Thanks,
> Dan
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D&C 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2016-11-29 Thread Dan Liebgold
On Tuesday, November 29, 2016 at 12:23:32 PM UTC-8, Jay McCarthy wrote:
> DrDr uses job-queue for a similar process
> 
> http://docs.racket-lang.org/job-queue/index.html
> 

Looks promising. However, the docs say that stop-job-queue! will block until 
jobs are done... and this code doesn't wait: http://pasterack.org/pastes/29869

Did I miss something?

Thanks,
Dan

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2016-11-29 Thread Sam Tobin-Hochstadt
Typed Racket uses this code:
https://github.com/racket/typed-racket/blob/master/typed-racket-test/send-places.rkt
to manage a job queue for testing.

Sam

On Tue, Nov 29, 2016 at 3:23 PM, Jay McCarthy  wrote:
> DrDr uses job-queue for a similar process
>
> http://docs.racket-lang.org/job-queue/index.html
>
> Jay
>
>
> On Tue, Nov 29, 2016 at 2:22 PM, Dan Liebgold
>  wrote:
>> I find myself implementing make (or something similar) in Racket... can 
>> anyone point to a good example of the job server portion?  Specifically: 
>> code to spawn and maintain N subprocesses from a list of jobs to run.
>>
>> Thanks,
>> Dan
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Jay McCarthy
> Associate Professor
> PLT @ CS @ UMass Lowell
> http://jeapostrophe.github.io
>
>"Wherefore, be not weary in well-doing,
>   for ye are laying the foundation of a great work.
> And out of small things proceedeth that which is great."
>   - D&C 64:33
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] implementing make in racket

2016-11-29 Thread Jay McCarthy
DrDr uses job-queue for a similar process

http://docs.racket-lang.org/job-queue/index.html

Jay


On Tue, Nov 29, 2016 at 2:22 PM, Dan Liebgold
 wrote:
> I find myself implementing make (or something similar) in Racket... can 
> anyone point to a good example of the job server portion?  Specifically: code 
> to spawn and maintain N subprocesses from a list of jobs to run.
>
> Thanks,
> Dan
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D&C 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] implementing make in racket

2016-11-29 Thread Dan Liebgold
I find myself implementing make (or something similar) in Racket... can anyone 
point to a good example of the job server portion?  Specifically: code to spawn 
and maintain N subprocesses from a list of jobs to run.

Thanks,
Dan

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.