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 6NiELT9anmKysgAAbAwnHQ (envelope-from ) for ; Mon, 06 Jun 2022 21:49:19 +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 eBV3LT9anmIeUwAA9RJhRA (envelope-from ) for ; Mon, 06 Jun 2022 21:49:19 +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 0734F3FBFE for ; Mon, 6 Jun 2022 21:49:18 +0200 (CEST) Received: from localhost ([::1]:51794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyIiz-0001Sq-7y for larch@yhetil.org; Mon, 06 Jun 2022 15:49:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyIiv-0001Q7-Nm for gwl-devel@gnu.org; Mon, 06 Jun 2022 15:49:13 -0400 Received: from smtp.polymtl.ca ([132.207.4.11]:50097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyIit-00087Q-GP for gwl-devel@gnu.org; Mon, 06 Jun 2022 15:49:13 -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 256Jn1om029342 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 6 Jun 2022 15:49:10 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 256Jn1om029342 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1654544950; bh=pZyKdFi23wqtpGG7kmcWEmCY/6/2KqCjqz6CrzrxVHw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BA0grGXg3VbCc91X5KdWey3nn1Gd/DRFMyNHFgmbiZipx1jlqbIW0sEEB4KedElwS uwoy9MLLpo51n2q5TJoGhX96keYd+koehjQWtci9EDxNyim3+kIYLDpDSOhg/pd+Hv HHxGoV3I8J+0B8Rw/E4AkGUJ+1oY96dfzhb951G4= From: Olivier Dion To: Olivier Dion , gwl-devel@gnu.org Subject: [PATCH 3/3] graph: Add output switch Date: Mon, 6 Jun 2022 15:49:00 -0400 Message-Id: <20220606194900.27725-3-olivier.dion@polymtl.ca> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220606194900.27725-1-olivier.dion@polymtl.ca> References: <20220603183203.11092-1-olivier.dion@polymtl.ca> <20220606194900.27725-1-olivier.dion@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) at Mon, 6 Jun 2022 19:49:01 +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=1654544958; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=pZyKdFi23wqtpGG7kmcWEmCY/6/2KqCjqz6CrzrxVHw=; b=Nw+8NWIX/gkoITc7LsRMXFk6O0p7vRlQQxouNHAW5kXFgxthLCzrfxaGtMP7G5bwj6Zhyd S3NtAjGWzd67tknm6OhnqTqpATALfJdDJSactShQUTeDUVdlMyTSd+VxGPEvuYPPlxjafV 7R+bMldBzaM3Q0KN8M1Jr6+UvHp/z32o8NiYufY+FaGbIp8nWN86KD71qIdZX1d6sBRYkJ 1Is8xDR/6doQggEk5BrLDTuK1luHWMaeIK4iXxZkQ5kez13jTj7Yi+QMQoYTAPUdVCSzGk aNK6AWkV+J6+e5xlTxIE3hW/IMFZUHu14cGCP1yrxKRZuC01UZF4OBo99KsQsA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654544958; a=rsa-sha256; cv=none; b=eIT2/qPh7+kdututWRhk1fxghzr7k7oD987kogEaYDuWulrK9upqOpRgejr1QZh9CbBQP3 vH3Fj4kMZqz/eyuXQOToaKGRSgRX3LK5gZRf2FX2k7NRTN0uzKDqU30jBONETHQzLwQZnC d68EzGKycfJ7BA81ip7yiX9EpuextwQ4jllGD7ZZ5t0+ntDYA1SdPFOtCRBd0BkoRdBN8d pxdcRuwboQoTqAsub6+5/t3zcEdW9UUdhTl700tmp9oYHowPKHcMZgdDaEYDvYuHIImmo5 xx2nBQXN7sCM0y/Jf4NA8MLMj6s9WNUCMkmaamhhWzMU4410jLFGJiE5FsfXcw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=polymtl.ca header.s=default header.b=BA0grGXg; 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: -3.71 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=polymtl.ca header.s=default header.b=BA0grGXg; 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: 0734F3FBFE X-Spam-Score: -3.71 X-Migadu-Scanner: scn1.migadu.com X-TUID: CAxDRXGu7CSc --- gwl/config.scm.in | 9 ++++++++- gwl/main.scm | 13 ++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/gwl/config.scm.in b/gwl/config.scm.in index 728eec5..1e0b4d0 100644 --- a/gwl/config.scm.in +++ b/gwl/config.scm.in @@ -148,7 +148,14 @@ workflow.") format) of the specified workflow.") (keywords (list - log-event-switch)) + log-event-switch + (switch + (name 'output) + (character #\o) + (default #false) + (test string?) + (synopsis "Write dot graph to .") + (example "")))) (arguments (list (argument diff --git a/gwl/main.scm b/gwl/main.scm index 78494fd..7f0fd14 100644 --- a/gwl/main.scm +++ b/gwl/main.scm @@ -17,6 +17,7 @@ (define-module (gwl main) #:use-module (config) #:use-module (config api) + #:use-module ((guix build utils) #:select (mkdir-p)) #:use-module (gwl errors) #:use-module (gwl process-engines) #:use-module (gwl web-interface) @@ -95,5 +96,15 @@ (parameterize ((*current-filename* file-name)) (match (load-workflow file-name) ((? workflow? wf) - (format #t "~a\n" (workflow->dot wf))) + + (define (flush) + (format #t "~a\n" (workflow->dot wf))) + + (define output (%config 'output)) + + (if output + (begin + (mkdir-p (dirname output)) + (with-output-to-file output flush)) + (flush))) (_ (leave (G_ "Failed to process the workflow.~%"))))))))))) -- 2.36.1