Skip to content

Instantly share code, notes, and snippets.

@agocorona
Last active June 22, 2018 20:57
Show Gist options
  • Select an option

  • Save agocorona/c0ab52807565f9fff935f63b7fea3987 to your computer and use it in GitHub Desktop.

Select an option

Save agocorona/c0ab52807565f9fff935f63b7fea3987 to your computer and use it in GitHub Desktop.

Services are a standard feature of transient. a service is a transient program with a diferent codebase than the one of the calling program. the services are initiated stand alone or by the monitor service. Although they are transient haskell programs, they can execute internally wathever :they can do FFI or execute a shell. They can also be packaged into docker images.

monitorService:

-is an executable included in transient -it should run in each node of the cloud:

     monitorService -p start/thishost/3000    # first node 
     monitorService -p start/otherhost/3000/add/thishost/3000/y   # next node connected to the first
     ...

So all the monitors of all the nodes are connected.

The monitor is called form a transient program with

     requestInstance :: PIN -> Service -> NumInstances -> Cloud [Node]

     data Service= [("String","String")]
     
     
     node <- requestInstance "KEY"  servicedesc  1
     result <- callService' node param
     donext result
     ...

This assoc list contains the service description. Below there are an example of service description

requestInstance provision the service. it sends the specification of a service to the monitor. This install (if necessary) and run it (if necessary) if the service is running, it return the node immediately. if the monitor service executable is not running, requestInstace initiates it. the returned nodes are added to the list of known nodes. Instances are provisioned among the available nodes

callService' is the primitive that call the service with the param and return the result (or results if it returns an stream of events)

also:

   initService :: initService :: String -> Service -> Cloud Node

initService search for a node in the local list of nodes, instead of calling the monitor. if there is no such node, it call requestInstance. initService is used by callService

The monitor also can be called with

    callService :: PIN -> Service  ->  a  -> Cloud b

it is a direct form of call to the service. Internally it uses the two previous primitives

Services are independent programs. This is the code of a service that echo his parameter each second:

streamEchoService= 
                [("service","streamEchoService")
                ,("executable", "streamEchoService")
                ,("package","https://github.com/blabla/streamecho")]

if we put this code with the corresponding cabal file:

main=  keep . runCloud $ 
   runService streamEchoService 4000 $ serv 
   where
   serv param =  do 
       waitEvents $ threadDelay 1000000 >> return param
       

The body of the service can invoke anything, for example FFI to anything, invoke a shell etc.

The port 4000 is the default port but the monitor can assign any other port.

Besides installing from GIT it can also provision and execute docker images

[("service","other") ,("image", "http://hub.docker.com/.....")]

Now the differences between transient services and cloudshell

Functionality transient services cloudShell
config file no yes
install dependencies no yes
run non transient programs within serivices via configuration files
install before run git-cabal/docker script in configuration file
monitoring execution no yes
checkpoint/recovery no yes (not fully implemented)
web monitoring not yet not yet
transient services yes it is a particular case
clearance/respawn on fail need some rework need rework

CloudShell status: Need a redesign to embed some of his functionalities in transient services others as utility libraries

@o1lo01ol1o
Copy link
Copy Markdown

o1lo01ol1o commented Jun 22, 2018

funflow like.

  • What is the scalability of this? If we have a workflow that processes 500gb of data, through 3 transformations across 3 nodes, will the checkpointing hold up? Are the "Checkpoints" stored on node-local disks?
    • theoretically that should be possible.
    • Yes. the checkpoints are stored locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment