Coder Social home page Coder Social logo

onyx-local-rt's Introduction

onyx-local-rt

onyx-local-rt is an alternative runtime for Onyx that executes jobs in a pure, deterministic environment. This runtime is local-only, and does not run in a distributed mode. This is an incubating repository, meaning this code will be moved into Onyx core at a later date.

Goals

  • Offer a subset of the Distributed Runtime functionality in an easier-to-configure environment.
  • Target ClojureScript as an underlying execution environment.
  • Guarantee ordering of message flow throughout jobs.
  • Share as much code as possible with the Distributed Runtime.

Differences from the Distributed Runtime

  • There are no job or task schedulers.
  • There is no backpressure.
  • There is no multi-node execution or network calls.
  • There are no threads, parallelism, or atoms.
  • There are no peers or virtual peers.
  • There are no fault tolerance mechanisms.
  • Input and output plugins are ignored, use the API to put segments into/take segments out of the runtime.
  • This runtime is not designed to be ultra-high performance.

Usage

In your project.clj:

[org.onyxplatform/onyx-local-rt "0.10.0.0-rc2"]

First, Require the only file, api.cljc, and define any functions that will be used. Next, call init with your job. You can then add new segments to an input task (new-segment), move the runtime forward (tick), move the runtime forward until all in-flight segments have reached their outputs (drain), or simulate the job shutting down (stop). All API functions take and return the runtime.

View the API on GitHub Pages.

As an example for Clojure(Script):

(:require [onyx-local-rt.api :as api])

;; ^:export the function if using in ClojureScript.
(defn ^:export my-inc [segment]
  (update-in segment [:n] inc))

(def job
  {:workflow [[:in :inc] [:inc :out]]
   :catalog [{:onyx/name :in
              :onyx/type :input
              :onyx/batch-size 20}
             {:onyx/name :inc
              :onyx/type :function
              :onyx/fn ::my-inc
              :onyx/batch-size 20}
             {:onyx/name :out
              :onyx/type :output
              :onyx/batch-size 20}]
   :lifecycles []})

(pprint
 (-> (api/init job)
     (api/new-segment :in {:n 41})
     (api/new-segment :in {:n 84})
     (api/drain)
     (api/stop)
     (api/env-summary)))

;; =>
;; {:next-action :lifecycle/start-task?,
;;  :tasks
;;  {:in {:inbox []},
;;   :inc {:inbox []},
;;   :out {:inbox [], :outputs [{:n 42} {:n 85}]}}}

License

Copyright © 2016 Distributed Masonry

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

onyx-local-rt's People

Contributors

lbradstreet avatar michaeldrogalis avatar yonatane avatar

Watchers

Christopher Small avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.