<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 閱讀(555) 評論(0)  編輯  收藏 所屬分類: Python


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


    網站導航:
     
    主站蜘蛛池模板: 免费观看无遮挡www的小视频| xxxxx做受大片视频免费| 在线精品亚洲一区二区三区| 2020因为爱你带字幕免费观看全集| 国产精品亚洲五月天高清| 亚洲人成电影在线天堂| 国产午夜亚洲不卡| 免费jjzz在在线播放国产| 久久受www免费人成_看片中文| 成人网站免费大全日韩国产| 欧洲亚洲国产精华液| 亚洲视频无码高清在线| 亚洲老熟女@TubeumTV| 亚洲VA中文字幕无码毛片| 国产亚洲精久久久久久无码77777| 日韩免费视频网站| 免费在线精品视频| 亚洲乱码国产一区网址| 亚洲色欲久久久久综合网| 亚洲日本在线观看视频| 亚洲人成影院在线无码观看| 亚洲欧洲中文日韩av乱码| 亚洲熟妇丰满多毛XXXX| 亚洲精品无码久久千人斩| 亚洲国产一二三精品无码| 久久精品亚洲日本佐佐木明希| 亚洲AV综合色区无码一区爱AV| 亚洲一区二区成人| 亚洲av色香蕉一区二区三区| 免费无码专区毛片高潮喷水 | 一级日本高清视频免费观看| 一个人看的在线免费视频| A级毛片高清免费视频在线播放| 日本不卡免费新一区二区三区| 国产精品视频免费观看| 免费A级毛片无码A∨男男| 亚洲AV日韩AV天堂一区二区三区| 亚洲色大情网站www| a级毛片黄免费a级毛片| 午夜老司机免费视频| 亚洲AV日韩AV永久无码下载|