Share
Embed
研究を支える拡張性の高い ワークフローツールの提案 / Proposal of highly expandable workflow tools to support research
2024-12-19 のさくらインターネット研究所の合宿で使用した資料
linyows
December 19, 2024
Transcript
25 slides
-
Tomohisa Oda @linyows • さくらインターネット研究所 所属 • メールの研究をしながら事業部のお手伝い • 筋トレとテニスが趣味
• Fukuoka.go オーガナイザ -
ソフトウェアにおける実験 • ソフトウェアなので実験の再現が容易 • 環境はクラウドや汎用PCによって揃えやすいし提 供しやすい • Infrastructure as Codeは当たり前
• 再現性のある実験はワークフローツールを使うこ とで実現できるだろう Created by LUTFI GANI AL ACHMAD from Noun Project Created by LUTFI GANI AL ACHMAD from Noun Project Created by LUTFI GANI AL ACHMAD from Noun Project 👍 -
既存のワークフローツール1 • GNU Make, Taskfile:タスク実行系 コマンド依存かつ正しく動く保証がない • N8n, Make(ex integromat):ワークフロー自動化SaaS系
定義ファイルのエクスポートはできるがサービス依存で敷居が高い • Ansible:IaC系 実験環境の構築には必要だが実験の内容を定義するにはスコープが異なる • Gradle, Apache Ant, Apache Maven:ビルド系 定義ファイルがXMLだったりする、そしてjavava… -
既存のワークフローツール2 • Artillery, Gatling, Apache JMater:負荷テスト系 Javaで記述したシナリオの実行はできる • Apache Airflow:データパイプライン系
複数のコンポーネントが必要で環境構築が面倒 • Jenkins:CI/CD系 これも想定ユースケースが異なるが何でもできる • Postman, Insomnia, Runn:シナリオテスト系 前2つはjsで記述、runnはyamlで記述、だがいずれも拡張ができない -
既存のワークフロー定義 • Common Workflow Language ワークフローの標準化仕様。これらの実装としてcwltoolやToilなど、多くのランタ イムがある。BioinformaticsやData Scienceなどの分野で使用される。 • Workflow
Description Language ゲノム解析を含むBioinformaticsで使用され、独自のDSLで定義する。実行エンジン はCromwellを使う。 クラウドやオンプレミスのサーバに大きいサイズのデータとスクリプトを配置して実 行するため、環境構築も一緒に行うワークフローエンジンとなる。分散処理や並列計 算も可能。 -
ワークフローツールの要件 • 一連の実験をワークフローとする • ワークフローは非エンジニアでも理解しやすいフォーマットで定義できる • 定義はファイルで既存のエコシステムでバージョン管理ができる • 定義ファイルから誰でも実行が可能(環境構築はスコープ外) •
ランタイムをプログラミング言語で拡張ができ比較的にメンテが楽 • メールの送受信に関するワークフローが定義できる -
ワークフローツールの要件 • 一連の実験をワークフローとする • ワークフローは非エンジニアでも理解しやすいフォーマットで定義できる • 定義はファイルで既存のエコシステムでバージョン管理ができる • 定義ファイルから誰でも実行が可能(環境構築はスコープ外) •
ランタイムをプログラミング言語で拡張ができ比較的にメンテが楽 • メールの送受信に関するワークフローが定義できる 私の研究的にはコレ -
要件対応表 Tool Definition Extension Email Workflow OSS Easy Setup GNU
Make makefile yes no yes yes Taskfile yaml yes no yes yes N8n json yes yes yes yes Make GUI limited no no yes Ansible yaml yes no yes yes Gradle xml or groovy yes no yes yes A-Ant xml or groovy yes no yes yes A-Maven xml or groovy yes no yes yes Artillery yaml limited no yes yes Gatling scala yes no yes yes A-JMater xml yes no yes yes A-Airflow yaml or json yes no yes no Jenkins yaml yes no yes yes Postman json no no no yes Insomnia json no no no yes Runn yaml no no yes yes -
モジュラーワークフローツール • 本体はワークフローの読み込みや結果を出力する機能とCliのみ • ワークフローのランタイムはモジュール化し、複数のモジュールを組み合 わせて実行する • モジュールは統一インターフェースを用いて外部プラグインとして拡張が 可能 •
プラグインはProtocol Buffersで様々なプログラミング言語で構築が可能 -
High-Level Architecture Go Binary HTTP SMTP GRPC Shell SSH IMAP
Built-in Plugins Actions Core Display FTP User Plugins Inter-Process Communication -
モジュラーワークフローツールの実装:Probe name: Example http workflow jobs: - name: Request REST
API defaults: http: url: http://localhost:9000 headers: authorization: Bearer {env.TOKEN} accept: application/json steps: - name: Get a user information uses: http with: get: /api/v1/me test: res.status == 200 && res.body.uname == foobar - name: Update user uses: http with: put: /api/v1/users/{steps[0].res.body.uid} body: profile: "I'm a software engineer living in Fukuoka." test: res.status == 201 HTTP Actionを使った例 -
モジュラーワークフローツールの実装:Probe name: Example http workflow jobs: - name: Request REST
API defaults: http: url: http://localhost:9000 headers: authorization: Bearer {env.TOKEN} accept: application/json steps: - name: Get a user information uses: http with: get: /api/v1/me test: res.status == 200 && res.body.uname == foobar - name: Update user uses: http with: put: /api/v1/users/{steps[0].res.body.uid} body: profile: "I'm a software engineer living in Fukuoka." test: res.status == 201 HTTP Actionを使った例 Actionの共通設定 -
モジュラーワークフローツールの実装:Probe name: Example http workflow jobs: - name: Request REST
API defaults: http: url: http://localhost:9000 headers: authorization: Bearer {env.TOKEN} accept: application/json steps: - name: Get a user information uses: http with: get: /api/v1/me test: res.status == 200 && res.body.uname == foobar - name: Update user uses: http with: put: /api/v1/users/{steps[0].res.body.uid} body: profile: "I'm a software engineer living in Fukuoka." test: res.status == 201 HTTP Actionを使った例 Actionが要求する引数をwithで定義 Actionの結果を検証をtestで定義 Stepは逐次処理される -
モジュラーワークフローツールの実装:Probe name: Send queue congestion experiment jobs: - name: Normal
sender id: normal-sender repeat: count: 60 interval: 10 steps: - use: smtp with: addr: localhost:5871 from: [email protected] to: [email protected] my-hostname: msa1-local subject: Experiment A - name: Throttled sender id: throtteled-sender repeat: count: 60 interval: 10 steps: - use: smtp with: addr: localhost:5872 from: [email protected] to: [email protected] my-hostname: msa2-local subject: Experiment B - name: Export latency as CSV needs: - normal-sender - throtteled-sender waitif: sh(postqueue -p 2> /dev/null | grep -c '^[A-F0-9]') != "0" steps: - use: mail-latency with: spath: /home/vmail dpath: ./latency.csv SMTP Actionを使った例 -
モジュラーワークフローツールの実装:Probe name: Send queue congestion experiment jobs: - name: Normal
sender id: normal-sender repeat: count: 60 interval: 10 steps: - use: smtp with: addr: localhost:5871 from: [email protected] to: [email protected] my-hostname: msa1-local subject: Experiment A - name: Throttled sender id: throtteled-sender repeat: count: 60 interval: 10 steps: - use: smtp with: addr: localhost:5872 from: [email protected] to: [email protected] my-hostname: msa2-local subject: Experiment B - name: Export latency as CSV needs: - normal-sender - throtteled-sender waitif: sh(postqueue -p 2> /dev/null | grep -c '^[A-F0-9]') != "0" steps: - use: mail-latency with: spath: /home/vmail dpath: ./latency.csv SMTP Actionを使った例 needsで指定するJobを待つ Waitifで条件を満たすまで待つ Jobは並行処理される -
Probeに追加予定の機能 • 実行結果の表示をリッチにする • GRPCやShellなどBuit-in Pluginsを増やす(今はHTTPとSMTPのみ) • Pre-JobやPost-Job、あるいはPost-Actionの追加(ワークフローとは関係 のない共通の事前事後処理) •
複数YAMLファイルのサポート(ワークフローの共通化などができる) • JobやStepの指定実行