From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id iJsLK4LnqGJpygAAbAwnHQ (envelope-from ) for ; Tue, 14 Jun 2022 21:54:42 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sEL2KoLnqGKdQQAA9RJhRA (envelope-from ) for ; Tue, 14 Jun 2022 21:54:42 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 33D8F33795 for ; Tue, 14 Jun 2022 21:54:42 +0200 (CEST) Received: from localhost ([::1]:49400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1Ccb-0008Ck-5f for larch@yhetil.org; Tue, 14 Jun 2022 15:54:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1CcW-0008CG-Il for gwl-devel@gnu.org; Tue, 14 Jun 2022 15:54:36 -0400 Received: from smtp.polymtl.ca ([132.207.4.11]:35377) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1CcU-000556-5s for gwl-devel@gnu.org; Tue, 14 Jun 2022 15:54:35 -0400 Received: from laura.hitronhub.home (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 25EJrc8P020673 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 14 Jun 2022 15:54:32 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 25EJrc8P020673 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1655236472; bh=C2RZsssTSlHMHXF9GDza6a4/lDOozAjVOTJUtIhcfgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AEtsAovoc4wcsV3Ee5HxKjaz2JxjNEfvEkbyrKtAQiePErJY/2zCHSlSMugbsgBNL xBCIrPxsdkdyJGhVsmqQHJjVN9hKyxGEoxlvFTQtj+xP94XFJSqROKnts6dRnXc4F5 2P/WXEJNVtBpZtgHGC/aj7uHlSdL8C2seyoRGdm0= From: Olivier Dion To: Olivier Dion via Cc: Olivier Dion Subject: [PATCH 1/2] gwl/workflows: Execute independent processes in parallel Date: Tue, 14 Jun 2022 15:53:36 -0400 Message-Id: <20220614195337.30570-1-olivier.dion@polymtl.ca> X-Mailer: git-send-email 2.36.1 In-Reply-To: <87edzxuyis.fsf@laura> References: <87edzxuyis.fsf@laura> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) at Tue, 14 Jun 2022 19:53:38 +0000 Received-SPF: pass client-ip=132.207.4.11; envelope-from=olivier.dion@polymtl.ca; helo=smtp.polymtl.ca X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: gwl-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gwl-devel-bounces+larch=yhetil.org@gnu.org Sender: "gwl-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1655236482; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=C2RZsssTSlHMHXF9GDza6a4/lDOozAjVOTJUtIhcfgY=; b=IqiChs3jAH30CC1wFxEpULFlBJd2juCyHp4XphRgB4eCdKdPREO/uWiStA0b8gu3DFZgXN JLoIF45VDPJUdRUMToOR2pTkWLX1Wky5GMQB4OVFwTzHIkBdmhrP0ZwWqJCjPuCIS8hoWV 4GIhnIr1RQyqJGTYS0o3tU11ZyQ/nNf7WxmZTbl7Dyao8GWR1WnznGS7DBBr9/+6iw90fW tImYsMk6KtcLtajLwjIyk8/BzX2BJJdy+PwV/C0XBVswG4FPKUTZ1GFMlOKBJcs0Izodr1 KKpBZFfM5XxONJOhFBDMbIjcCB5CE/UPtAFg7p8/HxTuaggsuhDxWJKa4ePbdA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1655236482; a=rsa-sha256; cv=none; b=DELA0VbHqp23FMrBPWB/MCqk++tTHskQR0e221QwWxD7Eq0+yfmfyhTHBpE8WsJ/2dpdTb zzPIDvGb1UWNKRbuNa+rox9HgfTjQ9U8FL9TknfRwSzSAXI/R4Ycbdzhrttu6m8KMUI/Wn V0XrCfvuz3qqhA391g+fEf4LJulSOqMGhbA2HSvehWUt8LP/1ajwQKxg4im2APAVSLwiLW zGQqcUItRAQJp6YNVqG9pg3aNyb4CNdPnBNXeZKSgnb+S4w5W8f94iNxaNfLEeNLXwJazV fAWJ5SeEFeauAwFPYzbuZLHjwcLsOxzWsnq1EZoWP7TQ4+75W/q/i0hPH90PBw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=polymtl.ca header.s=default header.b=AEtsAovo; dmarc=pass (policy=quarantine) header.from=polymtl.ca; spf=pass (aspmx1.migadu.com: domain of "gwl-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="gwl-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.19 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=polymtl.ca header.s=default header.b=AEtsAovo; dmarc=pass (policy=quarantine) header.from=polymtl.ca; spf=pass (aspmx1.migadu.com: domain of "gwl-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="gwl-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 33D8F33795 X-Spam-Score: -2.19 X-Migadu-Scanner: scn1.migadu.com X-TUID: 1jRawmp/0pLi Processes in the same list can be executed in parallel with `par-map'. The results are then appended to the accumulator. --- gwl/workflows.scm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gwl/workflows.scm b/gwl/workflows.scm index 03b29e0..74a1c74 100644 --- a/gwl/workflows.scm +++ b/gwl/workflows.scm @@ -43,6 +43,7 @@ #:use-module (ice-9 match) #:use-module (ice-9 format) + #:use-module (ice-9 threads) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9 gnu) #:use-module (srfi srfi-11) @@ -447,13 +448,12 @@ can be used in a fold over a WORKFLOW's processes." (lambda (item acc) (match item ((? list?) - (fold (lambda (process res) - (cons (proc process) res)) - acc - ;; By reversing the order of the processes - ;; in STEP we keep the output order the same - ;; as the order of the sequential function. - (reverse item))) + (append + ;; By reversing the order of the processes + ;; in STEP we keep the output order the same + ;; as the order of the sequential function. + (par-map (cut proc <>) (reverse item)) + acc)) (_ (cons (proc item) acc))))) (define* (workflow-prepare workflow engine -- 2.36.1