Code Monkey home page Code Monkey logo

kira's Introduction

About

๐Ÿšจ Currently beta grade software, I wouldn't recommend usage in production systems, or your personal projects for the matter ๐Ÿ˜‚

A concurrent task scheduler, intended to maximize through put of predefined tasks with clear dependencies on each other to run in parallel where possible. Whilst providing a means to rollback with as little pain as possible.

Installation

If available in Hex, the package can be installed by adding kira to your list of dependencies in mix.exs:

def deps do
  [
    {:kira, "~> 0.1.1"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/kira.

Example

require Kira
require Logger

task_a = %Kira.Branch{
  name: :get_a,
  apply: fn (config, deps) ->
    Logger.info(inspect(config))
    {:ok, 2}
  end,
}

task_b = %Kira.Branch{
  name: :get_b,
  apply: fn (config, deps) ->
    Logger.info(inspect(config))
    {:ok, 3}
  end,
}

task_c = %Kira.Branch{
  name: :get_c,
  dependencies: [:get_a, :get_b],
  apply: fn (config, deps) ->
    Logger.info(inspect(config))
    {:ok, deps[:get_a] + deps[:get_b]}
  end,
}

tasks = [task_a, task_b, task_c]
{:ok, results} = Kira.run_tasks(:my_config, tasks)
Logger.info(inspect(results))

# Should log
# 1: :my_config
# 2: :my_config
# 3: :my_config
# 4: %{ :get_a => 2, :get_b => 3, :get_c => 5 }

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.