Skip to content

Commit

Permalink
Merge pull request #231 from grondo/subprocess-io
Browse files Browse the repository at this point in the history
Subprocess io
  • Loading branch information
garlick committed Jul 13, 2015
2 parents 76197e6 + 9967d70 commit b61604c
Show file tree
Hide file tree
Showing 23 changed files with 1,424 additions and 106 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ AC_CONFIG_FILES( \
src/modules/modctl/Makefile \
src/modules/libmrpc/Makefile \
src/modules/libzio/Makefile \
src/modules/libsubprocess/Makefile \
src/modules/libkz/Makefile \
src/modules/libjsc/Makefile \
src/modules/live/Makefile \
Expand Down
3 changes: 2 additions & 1 deletion doc/cmd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ MAN1_FILES = \
flux-start.1 \
flux-config.1 \
flux-module.1 \
flux-exec.1
flux-exec.1 \
flux-ps.1

ADOC_FILES = $(MAN1_FILES:%.1=%.adoc)
XML_FILES = $(MAN1_FILES:%.1=%.xml)
Expand Down
16 changes: 12 additions & 4 deletions doc/cmd/flux-exec.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ flux-exec - Execute processes across flux ranks

SYNOPSIS
--------
*flux* *exec* ['--dir=DIR'] ['--rank=RANKS'] ['--verbose'] COMMANDS...
*flux* *exec* ['--labelio] ['--dir=DIR'] ['--rank=RANKS'] ['--verbose'] COMMANDS...


DESCRIPTION
-----------
flux-exec(1) runs commands across one or more cmb ranks using the 'cmb.exec'
service. The commands are direct children of cmbd, and stdio is thus folded
into the stdout and stderr of cmbd.
flux-exec(1) runs commands across one or more flux-broker ranks using
the 'cmb.exec' service. The commands are executed as direct children
of the broker, and the broker handles buffering stdout and stderr and
sends the output back to flux-exec(1) which copies output to its own
stdout and stderr.

On receipt of SIGINT and SIGTERM signals, flux-exec(1) shall forward
the received signal to all currently running remote processes.

flux-exec(1) is meant as an administrative and test utility, and should not
be used for executing lightweight jobs (LWJs) or user commands.
Expand All @@ -30,6 +35,9 @@ of flux-exec(1) is the largest of the remote process exit codes.
If a non-existent rank is targeted, flux-exec(1) will return with
code 68 (EX_NOHOST from sysexits.h).

If one or more remote commands are terminated by a signal, then flux-exec(1)
exits with exit code 128+signo.

OPTIONS
-------

Expand Down
45 changes: 45 additions & 0 deletions doc/cmd/flux-ps.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FLUX-PS(1)
============
:doctype: manpage


NAME
----
flux-ps - List managed subprocess of one or more flux brokers


SYNOPSIS
--------
*flux* *ps* ['--rank=RANKS'] ['--verbose'] COMMANDS...


DESCRIPTION
-----------
flux-ps(1) dumps a process listing from one or more flux-broker processes.
Processes are listed by sender UUID, broker rank, local PID, and
the command being run.

OPTIONS
-------

*-r, --rank*'=RANKS'::
Target specific ranks in 'RANKS'. Default is to target all ranks.

*-v, --verbose*::
Run with more verbosity.


AUTHOR
------
This page is maintained by the Flux community.


RESOURCES
---------
Github: <http://github.com/flux-framework>


COPYRIGHT
---------
include::COPYRIGHT.adoc[]

6 changes: 6 additions & 0 deletions doc/cmd/spell.en.pws
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,9 @@ fanout
NOHOST
sysexits
NODEID
SIGINT
SIGTERM
signo
subprocess
PID
ps
3 changes: 2 additions & 1 deletion src/bindings/lua/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ dist_lua_SCRIPTS = \
dist_fluxlua_SCRIPTS = \
flux-lua/timer.lua \
flux-lua/alt_getopt.lua \
flux-lua/posix.lua
flux-lua/posix.lua \
flux-lua/base64.lua

luaexec_LTLIBRARIES = \
flux.la
Expand Down
62 changes: 62 additions & 0 deletions src/bindings/lua/flux-lua/base64.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
--[[--------------------------------------------------------------------------
* Copyright (c) 2015 Lawrence Livermore National Security, LLC. Produced at
* the Lawrence Livermore National Laboratory (cf, AUTHORS, DISCLAIMER.LLNS).
* LLNL-CODE-658032 All rights reserved.
*
* This file is part of the Flux resource manager framework.
* For details, see https://github.com/flux-framework.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the license, or (at your option)
* any later version.
*
* Flux is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the terms and conditions of the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
* See also: http://www.gnu.org/licenses/
---------------------------------------------------------------------------]]
--
-- base64 encode/decode in Lua from:
-- http://lua-users.org/wiki/BaseSixtyFour
--
local T = {}
T.__index = T

local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'

function T.encode (data)
return ((data:gsub('.', function(x)
local r,b='',x:byte()
for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
return r;
end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
if (#x < 6) then return '' end
local c=0
for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
return b:sub(c+1,c+1)
end)..({ '', '==', '=' })[#data%3+1])
end

function T.decode (data)
data = string.gsub(data, '[^'..b..'=]', '')
return (data:gsub('.', function(x)
if (x == '=') then return '' end
local r,f='',(b:find(x)-1)
for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end
return r;
end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
if (#x ~= 8) then return '' end
local c=0
for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
return string.char(c)
end))
end

return T
-- vi: ts=4 sw=4 expandtab
1 change: 1 addition & 0 deletions src/broker/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ flux_broker_SOURCES = \
shutdown.c

flux_broker_LDADD = \
$(top_builddir)/src/modules/libsubprocess/libsubprocess.la \
$(top_builddir)/src/modules/kvs/libkvs.la \
$(top_builddir)/src/common/libflux-core.la \
$(top_builddir)/src/common/libflux-internal.la
Expand Down
Loading

0 comments on commit b61604c

Please sign in to comment.