{"id":1955,"date":"2009-11-12T23:41:21","date_gmt":"2009-11-13T06:41:21","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/?p=1955"},"modified":"2009-11-12T23:55:25","modified_gmt":"2009-11-13T06:55:25","slug":"process-runner-redux","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/","title":{"rendered":"Process Runner Redux"},"content":{"rendered":"<p><a href=\"http:\/\/multimedia.cx\/eggs\/process-of-confusion\/\">Pursuant to yesterday&#8217;s conundrum<\/a> of creating a portable process runner in Python for <a href=\"http:\/\/fate.multimedia.cx\/\">FATE<\/a> that can be reliably killed when exceeding time constraints, I settled on a solution. <a href=\"http:\/\/multimedia.cx\/eggs\/process-of-confusion\/#comment-150272\">As Raymond Tau reminded us<\/a> in the ensuing discussion, Python won&#8217;t use a shell to launch the process if the program can supply the command and its arguments as a sequence data structure. I knew this but was intentionally avoiding it. It seems like a simple problem to break up a command line into a sequence of arguments&#8211; just split on spaces. However, I hope to test metadata options eventually which could include arguments such as &#8216;-title &#8220;Hey, is this thing on?&#8221;&#8216; where splitting on spaces clearly isn&#8217;t the right solution.<\/p>\n<p>I got frustrated enough with the problem that I decided to split on spaces anyway. Hey, I control this system from top to bottom, so new rule: No command line arguments in test specs will have spaces with quotes around them. I already enforce the rule that no sample files can have spaces in their filenames since that causes trouble with remote testing. When I get to the part about testing metadata, said metadata will take the form of &#8216;-title &#8220;HeyIsThisThingOn?&#8221;&#8216; (which will then fail to catch myriad bugs related to FFmpeg&#8217;s incorrect handling of whitespace in metadata arguments, but this is all about trade-offs).<\/p>\n<p>So the revised Python process runner seems to work correctly on Linux.  The hangaround.c program simulates a badly misbehaving program by eating the TERM signal and must be dealt with using the KILL signal. The last line in these examples is a tuple containing return code, stdout, stderr, and CPU time. For Linux:<\/p>\n<pre>\r\n$ .\/upr.py \r\n['.\/hangaround', '40']\r\nprocess ID = 2645\r\ntimeout, sending TERM\r\ntimeout, really killing\r\n[-9, '', '', 0]\r\n<\/pre>\n<p>The unmodified code works the same on Mac OS X:<\/p>\n<pre>\r\n$ .\/upr.py\r\n['.\/hangaround', '40']\r\nprocess ID = 94866\r\ntimeout, sending TERM\r\ntimeout, really killing\r\n[-9, '', '', 0]\r\n<\/pre>\n<p>Now a bigger test: Running the upr.py script on Linux in order to launch the hangaround process remotely on Mac OS X via SSH:<\/p>\n<pre>\r\n$ .\/upr.py \r\n['\/usr\/bin\/ssh', 'foster-home', '.\/hangaround', '40']\r\nprocess ID = 2673\r\ntimeout, sending TERM\r\n[143, '', '', 50]\r\n<\/pre>\n<p>So that&#8217;s good&#8230; sort of. Monitoring the process on the other end reveals that hangaround is still doing just that, even after SSH goes away. This occurs whether or not hangaround is ignoring the TERM signal. This is still suboptimal.<\/p>\n<p>It would be possible to open a separate SSH session to send a TERM or KILL signal to the original process&#8230; except that I wouldn&#8217;t know the PID of the remote process. Or could I? I&#8217;m open to Unix shell magic tricks on this problem since anything responding to SSH requests is probably going to be acceptably Unix-like. I would rather not go the &#8216;killall ffmpeg&#8217; route because that could interfere with some multiprocessing ideas I&#8217;m working on.<\/p>\n<p>Here&#8217;s a brute force brainstorm: When operating in remote-SSH mode, prefix the command with &#8216;ln -s ffmpeg ffmpeg-&lt;unique-key&gt;&#8217; and then execute the symbolic link instead of the main binary. Then the script should be able to open a separate SSH session and execute &#8216;killall ffmpeg-&lt;unique-key&gt;&#8217; without interfering with other processes. Outlandish but possibly workable.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting closer to a bulletproof process runner for FATE<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101,55],"tags":[],"class_list":["post-1955","post","type-post","status-publish","format-standard","hentry","category-fate-server","category-python"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Getting closer to a bulletproof process runner for FATE\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Multimedia Mike\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Process Runner Redux | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta property=\"og:description\" content=\"Getting closer to a bulletproof process runner for FATE\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2009-11-13T06:41:21+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2009-11-13T06:55:25+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Process Runner Redux | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Getting closer to a bulletproof process runner for FATE\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-runner-redux\\\/#article\",\"name\":\"Process Runner Redux | Breaking Eggs And Making Omelettes\",\"headline\":\"Process Runner Redux\",\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"},\"datePublished\":\"2009-11-12T23:41:21-08:00\",\"dateModified\":\"2009-11-12T23:55:25-08:00\",\"inLanguage\":\"en-US\",\"commentCount\":12,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-runner-redux\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-runner-redux\\\/#webpage\"},\"articleSection\":\"FATE Server, Python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-runner-redux\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/python\\\/#listItem\",\"name\":\"Python\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/python\\\/#listItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/python\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-runner-redux\\\/#listItem\",\"name\":\"Process Runner Redux\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-runner-redux\\\/#listItem\",\"position\":3,\"name\":\"Process Runner Redux\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/python\\\/#listItem\",\"name\":\"Python\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/\",\"name\":\"Multimedia Mike\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-runner-redux\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Multimedia Mike\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-runner-redux\\\/#webpage\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-runner-redux\\\/\",\"name\":\"Process Runner Redux | Breaking Eggs And Making Omelettes\",\"description\":\"Getting closer to a bulletproof process runner for FATE\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/process-runner-redux\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"datePublished\":\"2009-11-12T23:41:21-08:00\",\"dateModified\":\"2009-11-12T23:55:25-08:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Process Runner Redux | Breaking Eggs And Making Omelettes","description":"Getting closer to a bulletproof process runner for FATE","canonical_url":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/#article","name":"Process Runner Redux | Breaking Eggs And Making Omelettes","headline":"Process Runner Redux","author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"},"datePublished":"2009-11-12T23:41:21-08:00","dateModified":"2009-11-12T23:55:25-08:00","inLanguage":"en-US","commentCount":12,"mainEntityOfPage":{"@id":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/#webpage"},"isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/#webpage"},"articleSection":"FATE Server, Python"},{"@type":"BreadcrumbList","@id":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs#listItem","position":1,"name":"Home","item":"https:\/\/multimedia.cx\/eggs","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/python\/#listItem","name":"Python"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/python\/#listItem","position":2,"name":"Python","item":"https:\/\/multimedia.cx\/eggs\/category\/python\/","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/#listItem","name":"Process Runner Redux"},"previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/#listItem","position":3,"name":"Process Runner Redux","previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/python\/#listItem","name":"Python"}}]},{"@type":"Organization","@id":"https:\/\/multimedia.cx\/eggs\/#organization","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","url":"https:\/\/multimedia.cx\/eggs\/"},{"@type":"Person","@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author","url":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/","name":"Multimedia Mike","image":{"@type":"ImageObject","@id":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Multimedia Mike"}},{"@type":"WebPage","@id":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/#webpage","url":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/","name":"Process Runner Redux | Breaking Eggs And Making Omelettes","description":"Getting closer to a bulletproof process runner for FATE","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/#website"},"breadcrumb":{"@id":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/#breadcrumblist"},"author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"creator":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"datePublished":"2009-11-12T23:41:21-08:00","dateModified":"2009-11-12T23:55:25-08:00"},{"@type":"WebSite","@id":"https:\/\/multimedia.cx\/eggs\/#website","url":"https:\/\/multimedia.cx\/eggs\/","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","inLanguage":"en-US","publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"}}]},"og:locale":"en_US","og:site_name":"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering","og:type":"article","og:title":"Process Runner Redux | Breaking Eggs And Making Omelettes","og:description":"Getting closer to a bulletproof process runner for FATE","og:url":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/","article:published_time":"2009-11-13T06:41:21+00:00","article:modified_time":"2009-11-13T06:55:25+00:00","twitter:card":"summary","twitter:title":"Process Runner Redux | Breaking Eggs And Making Omelettes","twitter:description":"Getting closer to a bulletproof process runner for FATE"},"aioseo_meta_data":{"post_id":"1955","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-31 22:01:17","updated":"2025-12-31 19:16:40","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\/category\/python\/\" title=\"Python\">Python<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tProcess Runner Redux\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/multimedia.cx\/eggs"},{"label":"Python","link":"https:\/\/multimedia.cx\/eggs\/category\/python\/"},{"label":"Process Runner Redux","link":"https:\/\/multimedia.cx\/eggs\/process-runner-redux\/"}],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/1955","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/comments?post=1955"}],"version-history":[{"count":9,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/1955\/revisions"}],"predecessor-version":[{"id":1961,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/1955\/revisions\/1961"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=1955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=1955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=1955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}