Skip to content

Instantly share code, notes, and snippets.

View vheaffinitech's full-sized avatar

Vincent Heuschling vheaffinitech

View GitHub Profile
{
"labels": "app:helloworld",
"type": "service",
"published" : {
"access": "affini-tech",
"prefix": "/helloworld/"
},
"name": "helloworld",
"image-destination": "eu.gcr.io/datataskio/hello_world:0.1",
"image-pull-policy": "Always",
{
"name":"my_pipeline",
"original":"pipeline_example",
"tasks":[
{
"name" :"job1",
"namespacetask":"quick_start/job_sleep"
},
{
"name" :"job2",
{
"labels": "app:fibonacci",
"type": "job",
"name": "fibonacci",
"image-destination": "eu.gcr.io/datataskio/fibonacci:0.1",
"cmd": ["python","/code/fibbo.py","10"],
"cpu-limit": "0.20",
"memory-limit": "200Mi",
"cpu-request": "0.15",
"memory-request": "150Mi",
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.enableCheckpointing(5000); // checkpoint every 5000 msecs
env.setParallelism(2); // 2 workers
val route =
path("req") {
get {
parameter("name") { name =>
requestActor ! Req(name)
complete(s"Request sent for $name ! ")
}
}
} ~
path("reqresp") {
val route =
path("hello") {
get {
parameter("name") { (name) =>
complete(s"Hello $name !")
}
} ~
post {
parameter("name") { (name) =>
complete(s"Posting $name !")
@vheaffinitech
vheaffinitech / first-akka-http.scala
Last active April 14, 2017 20:31
First AKKA-HTTP
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.server.Directives._
import akka.stream.ActorMaterializer
object Main extends App {
implicit val system = ActorSystem("HelloSystem")
implicit val materializer = ActorMaterializer()
implicit val executionContext = system.dispatcher
@vheaffinitech
vheaffinitech / Fetch_REST_API_React.js
Last active November 8, 2016 08:58
How to use rest resources in React with Fetch
export default class TestPage extends Component {
constructor(props) {
super(props);
// ....
this.processResponse = this.processResponse.bind(this);
}
processResponse(jsonObject){
console.log("processing...")
console.log(jsonObject[0]['username'])
// on the top of the hierarchy define a collector actor
val collector = system.actorOf(Props[CollectorActor], name = "collector")
// in all the routed actors insert this to send results
context.actorSelection("/user/collector") ! Response(s"(SecondActor:$t)")
class FirstActor() extends Actor {
def receive = {
case Msg(t) => {
???
} } }
object Main extends App {
val system = ActorSystem("HelloSystem")
val a1 = system.actorOf(Props[FirstActor], name = "a1")
val a2 = system.actorOf(Props[FirstActor], name = "a2")