<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    weidagang2046的專欄

    物格而后知致
    隨筆 - 8, 文章 - 409, 評論 - 101, 引用 - 0
    數據加載中……

    Osh

    In a Unix shell, you can run a series of commands, connecting the output of one command with the input to the next command using pipes. The information passed from one command to the next is normally organized into lines of text. Tools such as awk and sed are designed to extract and transform information from these lines. It would be much simpler if the data passed between commands was organized into objects. Osh is based on this idea. Osh is implemented in Python, so much of osh will be familiar if you already know Python.

    Osh is not a shell. It is an executable implementing a language that supports the composition of commands through piping. The objects piped from one command to the next can be Python primitives (numbers, lists, maps, etc.), other useful types such as dates/times, or database rows; or represent various OS resources such as files, directories, and processes. Conversions between objects and strings simplify integration with the Unix environment. The commands included with osh manipulate objects, access databases, and execute commands remotely, including parallel execution on nodes in a cluster. In a single osh invocation, all commands run in a single process. Multithreading is used only when executing commands on a cluster.

    Example: Suppose you have a cluster named fred, with nodes fred1, fred2, fred3. Each node has a database tracking work requests with a table named request. You can find the total number of open requests in each database as follows:

    [jao@zack] osh @fred [ sql "select count(*) from request where state = 'open'" ] ^ out
    ('fred1', 1)
    ('fred2', 0)
    ('fred3', 5)
    
    • osh: Invokes the osh executable.
    • @fred [ ... ]: Specifies that the following command, delimited by [...] should be run on each node of the cluster named fred. (The osh configuration file, .oshrc, specifies how to connect to the nodes of the cluster.)
    • sql "select count(*) from request where state = 'open'": Sql is an osh command that submits a query to a relational database. The query output is returned as a set of tuples.
    • ^ out: ^ is the osh operator for piping objects from one command to the next In this case, the input objects are tuples resulting from execution of a SQL query on each node of the cluster. The out command renders each object as a string and prints it to stdout.
    • Each output row identifies the node of origination (e.g. fred1, fred2), and contains a tuple from the database on that node. So ('fred3', 5) means that the database on node fred3 has 5 open requests.

    Example, continued: Now suppose you want to find the total number of open requests across the cluster. You can pipe the tuples into an aggregation command:

    [jao@zack] osh @fred [ sql "select count(*) from request where state = 'open'" ] ^ agg 0 'total, node, count: total + count' $
    6
    
    • agg: agg is the aggregation command. Tuples from across the cluster are piped into the agg command, which will accumulate results from all inputs.
    • 0: This use of agg will maintain a total, which is initialized to 0.
    • 'total, node, count: total + count': This specifies an aggregation function. total is the running total, which was initialized to 0. node and count come from the sql command executed on each node of the cluster. total + count accumulates the counts from each node.
    • $: An alternative to ^ out that can be used at the end of a command only.
    • 6: The total of the counts from across the cluster.

    More information:

    License: GPL
    Release history
    Tutorial (TBD)
    User guide
    Download
    Software with similar goals


    jao@geophile.com

    from: http://geophile.com/osh/

    posted on 2005-11-24 19:06 weidagang2046 閱讀(554) 評論(0)  編輯  收藏 所屬分類: Python


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 国产综合亚洲专区在线| 亚洲片一区二区三区| 亚洲国产精品成人综合色在线婷婷 | 亚洲www77777| 无码日韩人妻av一区免费| 亚洲成a人片在线观看中文!!!| 永久免费不卡在线观看黄网站| 亚洲AV日韩精品久久久久久| 久久精品乱子伦免费| 91情国产l精品国产亚洲区| 3344永久在线观看视频免费首页 | 无码乱肉视频免费大全合集| 亚洲国产人成在线观看| 亚色九九九全国免费视频| ass亚洲**毛茸茸pics| 成人毛片视频免费网站观看| 亚洲av无码成人精品区一本二本| 国产成人精品123区免费视频| 四虎国产精品永免费| 亚洲AV一宅男色影视| xxxx日本免费| 极品色天使在线婷婷天堂亚洲| 日产国产精品亚洲系列| 中文字幕不卡免费高清视频| 亚洲国产女人aaa毛片在线| 无码人妻一区二区三区免费手机 | 亚洲日韩看片无码电影| 午夜亚洲福利在线老司机| 国产日韩一区二区三免费高清| 亚洲美女精品视频| 免费毛片在线播放| 国产做国产爱免费视频| 久久精品国产99国产精品亚洲| 免费不卡中文字幕在线| 国产一区二区免费| 亚洲欧洲AV无码专区| 中文字幕亚洲乱码熟女一区二区| 最近免费中文在线视频| 青青视频免费在线| 亚洲精品成人网站在线播放| 国产免费人视频在线观看免费|