Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

https://github.com/geophile/osh

Osh (Object SHell) is a python application giving you a set of Linux like commands which can be composed similar to pipes. However, it is objects, not strings, that are passed from one command to the next.

It includes typical shell stuff, listing files and processes; database access, in which queries yield Python tuples; and distributed access, which distributes commands to the nodes of a cluster and then combines the results. For example, to submit a SQL query to each node of a cluster, getting a count on each, and combining the results:

    osh @cluster [ sql "select count(*) from request where state = 'open'" ] ^ f 'node, count: count' ^ red + $
- osh: Invoke the interpreter.

- @cluster: Relay the bracketed command to each node of the cluster. The bracketed command returns (node, count) tuples.

- sql: Submit a sql query (on a cluster node).

- ^: Denotes piping results from one command to the next.

- f: For each result from the cluster, run a function on (node, count) which returns just the count.

- red +: Reduce using +, summing up all the counts.

- $: Print result on the console.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: