lisp-project-of-the-day icon indicating copy to clipboard operation
lisp-project-of-the-day copied to clipboard

cl-reddit

Open utterances-bot opened this issue 5 years ago • 3 comments

cl-reddit

https://40ants.com/lisp-project-of-the-day/2020/06/0096-cl-reddit.html

utterances-bot avatar Jun 12 '20 09:06 utterances-bot

mmh let me check, I am using Dexador with Lparallel.

With comments:

  ;; Sometimes, after a C-z or hibernation,
  ;; if we don't recreate the kernel, netwwork requests can hang.
  (setf lparallel:*kernel* nil)
  (setf lparallel:*kernel* (lparallel:make-kernel 4))
   (get-all-titles)
   …

;; where get-all-titles contains:
    (lparallel:pmap 'list #'get-titles)

;; and get-titles contains:
  (dex:get url)

As says the comment I have experienced hickups (timeouts too?) if I create the lparalell kernel, pauses my computer and run the high-level function again, without creating a new kernel. Hope that helps.

vindarel avatar Jun 12 '20 09:06 vindarel

Do you know, when you are doing (setf lparallel:*kernel* nil) it does not destroy lparallel's threads and they can stay in the system and eat resources?

I have this function to stop these workers completely:

(def (function e) stop-lparallel-threads ()
  (setf lparallel.kernel::*lisp-exiting-p* t)
  (unwind-protect
       (loop for thread in (bt:all-threads)
             when (string= (bt:thread-name thread)
                           "LParallel")
             do (bt:destroy-thread thread))
    (sleep 5)
    (setf lparallel.kernel::*lisp-exiting-p* nil)))

Here "LParallel" is the name, I passed to the lparallel:make-kernel as :name argument.

svetlyak40wt avatar Jun 12 '20 09:06 svetlyak40wt

Without settings lparallel.kernel::*lisp-exiting-p* to t, all lparallel threads are relaunched automatically by a supervisor thread.

svetlyak40wt avatar Jun 12 '20 09:06 svetlyak40wt