<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>hayataka2049</author_name>
  <author_url>https://blog.hatena.ne.jp/hayataka2049/</author_url>
  <blog_title>静かなる名辞</blog_title>
  <blog_url>https://hayataka2049.hatenablog.jp/</blog_url>
  <categories>
    <anon>python</anon>
    <anon>Tips</anon>
    <anon>threading</anon>
  </categories>
  <description>概要 いつ使うんだと言われてしまうPythonのスレッドですが、Pythonの外で遅い原因があるときは高速化に威力を発揮します。 たとえばこんな感じです。言語はbashです。 #!/bin/bash sleep 3 echo &quot;hoge&quot; 特にひねりはありません。slow_command.shとでもして保存しておきます。 Pythonから呼ぶと、 import subprocess for _ in range(5): result = subprocess.run([&quot;./slow_command.sh&quot;], stdout=subprocess.PIPE) print(result.stdo…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhayataka2049.hatenablog.jp%2Fentry%2F2020%2F04%2F26%2F204907&quot; title=&quot;Pythonで遅いサブプロセスをスレッド並列でたくさん叩く - 静かなる名辞&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2020-04-26 20:49:07</published>
  <title>Pythonで遅いサブプロセスをスレッド並列でたくさん叩く</title>
  <type>rich</type>
  <url>https://hayataka2049.hatenablog.jp/entry/2020/04/26/204907</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
