SlideShare une entreprise Scribd logo
1  sur  71
Télécharger pour lire hors ligne
Processando análise genética em
background com Go
Marco Singer
Trilha Go - TDC 2018
Um pouco de contexto
Monolítico > Microserviços > Binário
~ vsa
vsa stands for *Very Simple Annotator*. This package annotates variants in VCF format
Usage:
vsa [command]
Available Commands:
dx Annotate and classify variants given a VCF file
help Help about any command
server Run vsa server at port 9090
train Prepare features for training or standardization
Flags:
-h, --help help for vsa
Use "vsa [command] --help" for more information about a command.
Simplificar a forma de
processamento dos exames
Premissas do
VSA-Worker ● Receber os exames que precisamos processar
● Delegar a execução para o nosso binário
● Notificar em caso de erro no processamento
Tecnologias
● RabbitMQ
● Apache Kafka
● Amazon SQS
● Sidekiq
Tecnologias
● RabbitMQ (exemplo)
● Apache Kafka
● Amazon SQS
● Sidekiq
Tecnologias
● RabbitMQ (exemplo)
● Apache Kafka (canhão)
● Amazon SQS
● Sidekiq
Tecnologias
● RabbitMQ (exemplo)
● Apache Kafka (canhão)
● Amazon SQS (não funciona offline)
● Sidekiq
Tecnologias
● RabbitMQ (exemplo)
● Apache Kafka (canhão)
● Amazon SQS (não funciona offline)
● Sidekiq (mais uma linguagem na stack)
Vamos no simples
Faktory
https://github.com/contribsys/faktory
● Criador do Sidekiq
● Feito em Go
● Clientes em Go e Ruby "oficiais"
● Usa RocksDB para persistência
● Vem com um dashboard built-in
● Retry automático
● Pode agendar execução de um job
Server
Rodando Faktory
docker pull contribsys/faktory
docker run --rm -it -p 7419:7419 -p 7420:7420 contribsys/faktory
Rodando Faktory
docker pull contribsys/faktory
docker run --rm -it -p 7419:7419 -p 7420:7420 contribsys/faktory
comunicação cliente / servidor
Rodando Faktory
docker pull contribsys/faktory
docker run --rm -it -p 7419:7419 -p 7420:7420 contribsys/faktory
porta da interface web
http://localhost:7420
Criando um job
Payload
Estrutura de um job
{
"jid": "123861239abnadsa",
"jobtype": "SomeName",
"args": [1, 2, "hello"]
}
Payload
Estrutura de um job
{
"jid": "123861239abnadsa",
"jobtype": "SomeName",
"args": [1, 2, "hello"]
}
ID único do job
Payload
Estrutura de um job
{
"jid": "123861239abnadsa",
"jobtype": "SomeName",
"args": [1, 2, "hello"]
}
nome da função
Payload
Estrutura de um job
{
"jid": "123861239abnadsa",
"jobtype": "SomeName",
"args": [1, 2, "hello"]
}
argumentos da função
Executando VSA através do Faktory
~ vsa dx --help
Annotate and classify variants given a VCF file.
Usage:
vsa dx [flags]
Flags:
--assembly string Supported assemblies: GRCh37 or GRCh38.
--vcf string VCF file address.
Criando um job
go get -u github.com/contribsys/faktory/client
import (
faktory "github.com/contribsys/faktory/client"
)
func send(){
client, err := faktory.Open()
if err != nil {
// tratamento de erro
}
defer client.Close()
job := faktory.NewJob("dx", "GRCh37", "/path/to/file")
if err := client.Push(job); err != nil {
// tratamento de erro
}
}
faktory.NewJob("dx", "GRCh37", "/path/to/file")
faktory.NewJob("dx", "GRCh37", "/path/to/file")
payload argspayload jobType
~ vsa dx --help
Annotate and classify variants given a VCF file.
Usage:
vsa dx [flags]
Flags:
--assembly string Supported assemblies: GRCh37 or GRCh38.
--vcf string VCF file address.
client.Push(job)
http://localhost:7420
http://localhost:7420
Processando um job
go get -u github.com/contribsys/faktory_worker_go
package worker
import (
worker "github.com/contribsys/faktory_worker_go"
)
package worker
import (
worker "github.com/contribsys/faktory_worker_go"
)
func Run() {
svc := worker.NewManager()
}
package worker
import (
worker "github.com/contribsys/faktory_worker_go"
)
func Run() {
svc := worker.NewManager()
svc.Register("dx", dxWorker)
}
package worker
import (
worker "github.com/contribsys/faktory_worker_go"
)
func Run() {
svc := worker.NewManager()
svc.Register("dx", dxWorker)
} payload jobType
package worker
import (
worker "github.com/contribsys/faktory_worker_go"
)
func Run() {
svc := worker.NewManager()
svc.Register("dx", dxWorker)
}
?
// github.com/contribsys/faktory_worker_go
func (mgr *Manager) Register(name string, fn Perform) {
}
type Perform func(ctx Context, args ...interface{}) error
func dxWorker(ctx worker.Context, args ...interface{}) error {
}
package worker
import (
worker "github.com/contribsys/faktory_worker_go"
)
func Run() {
svc := worker.NewManager()
svc.Register("dx", dxWorker)
}
package worker
import (
worker "github.com/contribsys/faktory_worker_go"
)
func Run() {
svc := worker.NewManager()
svc.Register("dx", dxWorker)
svc.Run()
}
Juntando todos os conceitos
Premissas do
VSA-Worker ● Receber os exames que precisamos processar
● Delegar a execução para o nosso binário
● Notificar em caso de erro no processamento
main.go
package main
import (
// ...
)
func main() {
// running workers in background
go func() {
worker.Run()
}()
// configure API handlers
svc := api.New()
http.Handle("/", svc.Handler())
logrus.WithField("port", config.Port).Info("starting server")
if err := http.ListenAndServe(":"+config.Port, nil); err != nil {
logrus.WithError(err).Fatalf("something went wrong")
}
}
main.go
package main
import (
// ...
)
func main() {
// running workers in background
go func() {
worker.Run()
}()
// configure API handlers
svc := api.New()
http.Handle("/", svc.Handler())
logrus.WithField("port", config.Port).Info("starting server")
if err := http.ListenAndServe(":"+config.Port, nil); err != nil {
logrus.WithError(err).Fatalf("something went wrong")
}
}
main.go
package main
import (
// ...
)
func main() {
// running workers in background
go func() {
worker.Run()
}()
// configure API handlers
svc := api.New()
http.Handle("/", svc.Handler())
logrus.WithField("port", config.Port).Info("starting server")
if err := http.ListenAndServe(":"+config.Port, nil); err != nil {
logrus.WithError(err).Fatalf("something went wrong")
}
}
api.go
package main
import (
// ...
)
func (s Service) Handler() *mux.Router {
r := mux.NewRouter()
r.PathPrefix("/api")
r.HandleFunc("/v1/import", s.importHandler).Methods("POST")
return r
}
api.go
package main
import (
// ...
)
func (s Service) Handler() *mux.Router {
r := mux.NewRouter()
r.PathPrefix("/api")
r.HandleFunc("/v1/import", s.importHandler).Methods("POST")
return r
}
api.go
type ImportInput struct {
Assembly string `json:"assembly,omitempty"`
Vcf string `json:"vcf,omitempty"`
}
func importHandler(w http.ResponseWriter, r *http.Request) {
var input ImportInput
json.NewDecoder(r.Body).Decode(&input)
client, _ := faktory.Open()
defer client.Close()
job := faktory.NewJob("dx", input.Assembly, input.Vcf)
client.Push(job)
w.WriteHeader(http.StatusOK)
}
api.go
type ImportInput struct {
Assembly string `json:"assembly,omitempty"`
Vcf string `json:"vcf,omitempty"`
}
func importHandler(w http.ResponseWriter, r *http.Request) {
var input ImportInput
json.NewDecoder(r.Body).Decode(&input)
client, _ := faktory.Open()
defer client.Close()
job := faktory.NewJob("dx", input.Assembly, input.Vcf)
client.Push(job)
w.WriteHeader(http.StatusOK)
}
api.go
type ImportInput struct {
Assembly string `json:"assembly,omitempty"`
Vcf string `json:"vcf,omitempty"`
}
func importHandler(w http.ResponseWriter, r *http.Request) {
var input ImportInput
json.NewDecoder(r.Body).Decode(&input)
client, _ := faktory.Open()
defer client.Close()
job := faktory.NewJob("dx", input.Assembly, input.Vcf)
client.Push(job)
w.WriteHeader(http.StatusOK)
}
main.go
package main
import (
// ...
)
func main() {
// running workers in background
go func() {
worker.Run()
}()
// configure API handlers
svc := api.New()
http.Handle("/", svc.Handler())
logrus.WithField("port", config.Port).Info("starting server")
if err := http.ListenAndServe(":"+config.Port, nil); err != nil {
logrus.WithError(err).Fatalf("something went wrong")
}
}
worker.go
package worker
import (
//
)
func Run() {
logrus.Info("starting workers in background mode")
svc := worker.NewManager()
logrus.WithField("jobType", "dx").Info("register job")
svc.Register("dx", dxWorker)
logrus.Info("waiting for jobs")
svc.Run()
}
func dxWorker(ctx worker.Context, args ...interface{}) error {
var (
assembly = args[0].(string)
vcf = args[1].(string)
)
cmd := exec.Command("vsa", "dx", "--assembly", assembly, "--vcf", vcf)
stderr, err := cmd.StderrPipe()
if err != nil {
return err
}
if err := cmd.Start(); err != nil {
return err
}
rerr, _ := ioutil.ReadAll(stderr)
if err := cmd.Wait(); err != nil {
return fmt.Errorf("%s", rerr)
}
return nil
}
func dxWorker(ctx worker.Context, args ...interface{}) error {
var (
assembly = args[0].(string)
vcf = args[1].(string)
)
cmd := exec.Command("vsa", "dx", "--assembly", assembly, "--vcf", vcf)
stderr, err := cmd.StderrPipe()
if err != nil {
return err
}
if err := cmd.Start(); err != nil {
return err
}
rerr, _ := ioutil.ReadAll(stderr)
if err := cmd.Wait(); err != nil {
return fmt.Errorf("%s", rerr)
}
return nil
}
func dxWorker(ctx worker.Context, args ...interface{}) error {
var (
assembly = args[0].(string)
vcf = args[1].(string)
)
cmd := exec.Command("vsa", "dx", "--assembly", assembly, "--vcf", vcf)
stderr, err := cmd.StderrPipe()
if err != nil {
return err
}
if err := cmd.Start(); err != nil {
return err
}
rerr, _ := ioutil.ReadAll(stderr)
if err := cmd.Wait(); err != nil {
return fmt.Errorf("%s", rerr)
}
return nil
}
func dxWorker(ctx worker.Context, args ...interface{}) error {
var (
assembly = args[0].(string)
vcf = args[1].(string)
)
cmd := exec.Command("vsa", "dx", "--assembly", assembly, "--vcf", vcf)
stderr, err := cmd.StderrPipe()
if err != nil {
return err
}
if err := cmd.Start(); err != nil {
return err
}
rerr, _ := ioutil.ReadAll(stderr)
if err := cmd.Wait(); err != nil {
return fmt.Errorf("%s", rerr)
}
return nil
}
http://localhost:7420
func dxWorker(ctx worker.Context, args ...interface{}) error {
var (
assembly = args[0].(string)
vcf = args[1].(string)
)
cmd := exec.Command("vsa", "dx", "--assembly", assembly, "--vcf", vcf)
stderr, err := cmd.StderrPipe()
if err != nil {
return err
}
if err := cmd.Start(); err != nil {
return err
}
rerr, _ := ioutil.ReadAll(stderr)
if err := cmd.Wait(); err != nil {
return fmt.Errorf("%s", rerr)
}
return nil
}
http://localhost:7420
Exemplo de call
// payload.json
{
"assembly":"GRCh37",
"vcf":"/home/marcosinger/files/FXM281-001.vcf.gz"
}
Exemplo de call
curl -XPOST 
-H "Content-Type: application/json" 
--data @payload.json 
http://host:port/api/v1/import
15 exames/hora
5 máquinas c4.4xlarge
Amazon SQS
MongoDB
Elasticsearch
200 exames/hora
1 máquina t2.large
Faktory
MongoDB
Obrigado!
Marco Singer
@mahsinger
linkedin.com/in/marcosinger
github.com/marcosinger

Contenu connexe

Tendances

FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 
Node.js/io.js Native C++ Addons
Node.js/io.js Native C++ AddonsNode.js/io.js Native C++ Addons
Node.js/io.js Native C++ AddonsChris Barber
 
RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術名辰 洪
 
ES6, 잘 쓰고 계시죠?
ES6, 잘 쓰고 계시죠?ES6, 잘 쓰고 계시죠?
ES6, 잘 쓰고 계시죠?장현 한
 
Writing native bindings to node.js in C++
Writing native bindings to node.js in C++Writing native bindings to node.js in C++
Writing native bindings to node.js in C++nsm.nikhil
 
Unit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and NodeUnit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and NodeJosh Mock
 
Reactive, component 그리고 angular2
Reactive, component 그리고  angular2Reactive, component 그리고  angular2
Reactive, component 그리고 angular2Jeado Ko
 
Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기JeongHun Byeon
 
Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSAdam L Barrett
 
Developing web-apps like it's 2013
Developing web-apps like it's 2013Developing web-apps like it's 2013
Developing web-apps like it's 2013Laurent_VB
 
Universal JavaScript
Universal JavaScriptUniversal JavaScript
Universal JavaScript名辰 洪
 
Building fast interpreters in Rust
Building fast interpreters in RustBuilding fast interpreters in Rust
Building fast interpreters in RustIngvar Stepanyan
 
You will learn RxJS in 2017
You will learn RxJS in 2017You will learn RxJS in 2017
You will learn RxJS in 2017名辰 洪
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuningAOE
 
Angular 1 + es6
Angular 1 + es6Angular 1 + es6
Angular 1 + es6장현 한
 
Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in GolangBo-Yi Wu
 

Tendances (20)

V8
V8V8
V8
 
FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6
 
Node.js/io.js Native C++ Addons
Node.js/io.js Native C++ AddonsNode.js/io.js Native C++ Addons
Node.js/io.js Native C++ Addons
 
RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術RxJS - 封裝程式的藝術
RxJS - 封裝程式的藝術
 
ES6, 잘 쓰고 계시죠?
ES6, 잘 쓰고 계시죠?ES6, 잘 쓰고 계시죠?
ES6, 잘 쓰고 계시죠?
 
Writing native bindings to node.js in C++
Writing native bindings to node.js in C++Writing native bindings to node.js in C++
Writing native bindings to node.js in C++
 
Unit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and NodeUnit testing JavaScript using Mocha and Node
Unit testing JavaScript using Mocha and Node
 
Reactive, component 그리고 angular2
Reactive, component 그리고  angular2Reactive, component 그리고  angular2
Reactive, component 그리고 angular2
 
Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기
 
Think Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJSThink Async: Asynchronous Patterns in NodeJS
Think Async: Asynchronous Patterns in NodeJS
 
Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6
 
Developing web-apps like it's 2013
Developing web-apps like it's 2013Developing web-apps like it's 2013
Developing web-apps like it's 2013
 
Universal JavaScript
Universal JavaScriptUniversal JavaScript
Universal JavaScript
 
Building fast interpreters in Rust
Building fast interpreters in RustBuilding fast interpreters in Rust
Building fast interpreters in Rust
 
You will learn RxJS in 2017
You will learn RxJS in 2017You will learn RxJS in 2017
You will learn RxJS in 2017
 
Qt Rest Server
Qt Rest ServerQt Rest Server
Qt Rest Server
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuning
 
Angular 1 + es6
Angular 1 + es6Angular 1 + es6
Angular 1 + es6
 
Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in Golang
 
Rust ⇋ JavaScript
Rust ⇋ JavaScriptRust ⇋ JavaScript
Rust ⇋ JavaScript
 

Similaire à TDC2018SP | Trilha Go - Processando analise genetica em background com Go

Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.Mike Brevoort
 
Full-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsMichael Lehmann
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js frameworkBen Lin
 
Rntb20200805
Rntb20200805Rntb20200805
Rntb20200805t k
 
Asynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsAsynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsPiotr Pelczar
 
Apache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customizationApache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customizationBartosz Konieczny
 
Expert JavaScript tricks of the masters
Expert JavaScript  tricks of the mastersExpert JavaScript  tricks of the masters
Expert JavaScript tricks of the mastersAra Pehlivanian
 
Lego: A brick system build by scala
Lego: A brick system build by scalaLego: A brick system build by scala
Lego: A brick system build by scalalunfu zhong
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsFrancois Zaninotto
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the wayOleg Podsechin
 
Matthew Eernisse, NodeJs, .toster {webdev}
Matthew Eernisse, NodeJs, .toster {webdev}Matthew Eernisse, NodeJs, .toster {webdev}
Matthew Eernisse, NodeJs, .toster {webdev}.toster
 
Writing Redis in Python with asyncio
Writing Redis in Python with asyncioWriting Redis in Python with asyncio
Writing Redis in Python with asyncioJames Saryerwinnie
 
apidays LIVE Australia - Building distributed systems on the shoulders of gia...
apidays LIVE Australia - Building distributed systems on the shoulders of gia...apidays LIVE Australia - Building distributed systems on the shoulders of gia...
apidays LIVE Australia - Building distributed systems on the shoulders of gia...apidays
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for CassandraEdward Capriolo
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"DataStax Academy
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Introduction to Scalding and Monoids
Introduction to Scalding and MonoidsIntroduction to Scalding and Monoids
Introduction to Scalding and MonoidsHugo Gävert
 
RESTful API using scalaz (3)
RESTful API using scalaz (3)RESTful API using scalaz (3)
RESTful API using scalaz (3)Yeshwanth Kumar
 
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemWprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemSages
 

Similaire à TDC2018SP | Trilha Go - Processando analise genetica em background com Go (20)

Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
 
Full-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.js
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
 
Rntb20200805
Rntb20200805Rntb20200805
Rntb20200805
 
Asynchronous programming done right - Node.js
Asynchronous programming done right - Node.jsAsynchronous programming done right - Node.js
Asynchronous programming done right - Node.js
 
Apache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customizationApache Spark in your likeness - low and high level customization
Apache Spark in your likeness - low and high level customization
 
Expert JavaScript tricks of the masters
Expert JavaScript  tricks of the mastersExpert JavaScript  tricks of the masters
Expert JavaScript tricks of the masters
 
Lego: A brick system build by scala
Lego: A brick system build by scalaLego: A brick system build by scala
Lego: A brick system build by scala
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the way
 
Matthew Eernisse, NodeJs, .toster {webdev}
Matthew Eernisse, NodeJs, .toster {webdev}Matthew Eernisse, NodeJs, .toster {webdev}
Matthew Eernisse, NodeJs, .toster {webdev}
 
Writing Redis in Python with asyncio
Writing Redis in Python with asyncioWriting Redis in Python with asyncio
Writing Redis in Python with asyncio
 
apidays LIVE Australia - Building distributed systems on the shoulders of gia...
apidays LIVE Australia - Building distributed systems on the shoulders of gia...apidays LIVE Australia - Building distributed systems on the shoulders of gia...
apidays LIVE Australia - Building distributed systems on the shoulders of gia...
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Introduction to Scalding and Monoids
Introduction to Scalding and MonoidsIntroduction to Scalding and Monoids
Introduction to Scalding and Monoids
 
RESTful API using scalaz (3)
RESTful API using scalaz (3)RESTful API using scalaz (3)
RESTful API using scalaz (3)
 
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemWprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
 

Plus de tdc-globalcode

TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidadeTDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidadetdc-globalcode
 
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...tdc-globalcode
 
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de SucessoTDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de Sucessotdc-globalcode
 
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPATDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPAtdc-globalcode
 
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVinoTDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVinotdc-globalcode
 
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...tdc-globalcode
 
TDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devicesTDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devicestdc-globalcode
 
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca PublicaTrilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publicatdc-globalcode
 
Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#tdc-globalcode
 
TDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case EasylocusTDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case Easylocustdc-globalcode
 
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?tdc-globalcode
 
TDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em GolangTDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em Golangtdc-globalcode
 
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QATDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QAtdc-globalcode
 
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendenciaTDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendenciatdc-globalcode
 
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR ServiceTDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Servicetdc-globalcode
 
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NETTDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NETtdc-globalcode
 
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8tdc-globalcode
 
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...tdc-globalcode
 
TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#tdc-globalcode
 
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net CoreTDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Coretdc-globalcode
 

Plus de tdc-globalcode (20)

TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidadeTDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
 
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
 
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de SucessoTDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
 
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPATDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
 
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVinoTDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
 
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
 
TDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devicesTDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devices
 
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca PublicaTrilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
 
Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#
 
TDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case EasylocusTDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case Easylocus
 
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
 
TDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em GolangTDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em Golang
 
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QATDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
 
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendenciaTDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
 
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR ServiceTDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
 
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NETTDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
 
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
 
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
 
TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#
 
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net CoreTDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
 

Dernier

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Dernier (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 

TDC2018SP | Trilha Go - Processando analise genetica em background com Go

  • 1. Processando análise genética em background com Go Marco Singer Trilha Go - TDC 2018
  • 2. Um pouco de contexto
  • 3.
  • 4.
  • 5.
  • 6.
  • 8. ~ vsa vsa stands for *Very Simple Annotator*. This package annotates variants in VCF format Usage: vsa [command] Available Commands: dx Annotate and classify variants given a VCF file help Help about any command server Run vsa server at port 9090 train Prepare features for training or standardization Flags: -h, --help help for vsa Use "vsa [command] --help" for more information about a command.
  • 9. Simplificar a forma de processamento dos exames
  • 10. Premissas do VSA-Worker ● Receber os exames que precisamos processar ● Delegar a execução para o nosso binário ● Notificar em caso de erro no processamento
  • 11. Tecnologias ● RabbitMQ ● Apache Kafka ● Amazon SQS ● Sidekiq
  • 12. Tecnologias ● RabbitMQ (exemplo) ● Apache Kafka ● Amazon SQS ● Sidekiq
  • 13. Tecnologias ● RabbitMQ (exemplo) ● Apache Kafka (canhão) ● Amazon SQS ● Sidekiq
  • 14. Tecnologias ● RabbitMQ (exemplo) ● Apache Kafka (canhão) ● Amazon SQS (não funciona offline) ● Sidekiq
  • 15. Tecnologias ● RabbitMQ (exemplo) ● Apache Kafka (canhão) ● Amazon SQS (não funciona offline) ● Sidekiq (mais uma linguagem na stack)
  • 17. Faktory https://github.com/contribsys/faktory ● Criador do Sidekiq ● Feito em Go ● Clientes em Go e Ruby "oficiais" ● Usa RocksDB para persistência ● Vem com um dashboard built-in ● Retry automático ● Pode agendar execução de um job
  • 19. Rodando Faktory docker pull contribsys/faktory docker run --rm -it -p 7419:7419 -p 7420:7420 contribsys/faktory
  • 20. Rodando Faktory docker pull contribsys/faktory docker run --rm -it -p 7419:7419 -p 7420:7420 contribsys/faktory comunicação cliente / servidor
  • 21. Rodando Faktory docker pull contribsys/faktory docker run --rm -it -p 7419:7419 -p 7420:7420 contribsys/faktory porta da interface web
  • 24. Payload Estrutura de um job { "jid": "123861239abnadsa", "jobtype": "SomeName", "args": [1, 2, "hello"] }
  • 25. Payload Estrutura de um job { "jid": "123861239abnadsa", "jobtype": "SomeName", "args": [1, 2, "hello"] } ID único do job
  • 26. Payload Estrutura de um job { "jid": "123861239abnadsa", "jobtype": "SomeName", "args": [1, 2, "hello"] } nome da função
  • 27. Payload Estrutura de um job { "jid": "123861239abnadsa", "jobtype": "SomeName", "args": [1, 2, "hello"] } argumentos da função
  • 29. ~ vsa dx --help Annotate and classify variants given a VCF file. Usage: vsa dx [flags] Flags: --assembly string Supported assemblies: GRCh37 or GRCh38. --vcf string VCF file address.
  • 30. Criando um job go get -u github.com/contribsys/faktory/client import ( faktory "github.com/contribsys/faktory/client" ) func send(){ client, err := faktory.Open() if err != nil { // tratamento de erro } defer client.Close() job := faktory.NewJob("dx", "GRCh37", "/path/to/file") if err := client.Push(job); err != nil { // tratamento de erro } }
  • 33. ~ vsa dx --help Annotate and classify variants given a VCF file. Usage: vsa dx [flags] Flags: --assembly string Supported assemblies: GRCh37 or GRCh38. --vcf string VCF file address.
  • 38. go get -u github.com/contribsys/faktory_worker_go
  • 39. package worker import ( worker "github.com/contribsys/faktory_worker_go" )
  • 40. package worker import ( worker "github.com/contribsys/faktory_worker_go" ) func Run() { svc := worker.NewManager() }
  • 41. package worker import ( worker "github.com/contribsys/faktory_worker_go" ) func Run() { svc := worker.NewManager() svc.Register("dx", dxWorker) }
  • 42. package worker import ( worker "github.com/contribsys/faktory_worker_go" ) func Run() { svc := worker.NewManager() svc.Register("dx", dxWorker) } payload jobType
  • 43. package worker import ( worker "github.com/contribsys/faktory_worker_go" ) func Run() { svc := worker.NewManager() svc.Register("dx", dxWorker) } ?
  • 44. // github.com/contribsys/faktory_worker_go func (mgr *Manager) Register(name string, fn Perform) { } type Perform func(ctx Context, args ...interface{}) error
  • 45. func dxWorker(ctx worker.Context, args ...interface{}) error { }
  • 46. package worker import ( worker "github.com/contribsys/faktory_worker_go" ) func Run() { svc := worker.NewManager() svc.Register("dx", dxWorker) }
  • 47. package worker import ( worker "github.com/contribsys/faktory_worker_go" ) func Run() { svc := worker.NewManager() svc.Register("dx", dxWorker) svc.Run() }
  • 48. Juntando todos os conceitos
  • 49. Premissas do VSA-Worker ● Receber os exames que precisamos processar ● Delegar a execução para o nosso binário ● Notificar em caso de erro no processamento
  • 50. main.go package main import ( // ... ) func main() { // running workers in background go func() { worker.Run() }() // configure API handlers svc := api.New() http.Handle("/", svc.Handler()) logrus.WithField("port", config.Port).Info("starting server") if err := http.ListenAndServe(":"+config.Port, nil); err != nil { logrus.WithError(err).Fatalf("something went wrong") } }
  • 51. main.go package main import ( // ... ) func main() { // running workers in background go func() { worker.Run() }() // configure API handlers svc := api.New() http.Handle("/", svc.Handler()) logrus.WithField("port", config.Port).Info("starting server") if err := http.ListenAndServe(":"+config.Port, nil); err != nil { logrus.WithError(err).Fatalf("something went wrong") } }
  • 52. main.go package main import ( // ... ) func main() { // running workers in background go func() { worker.Run() }() // configure API handlers svc := api.New() http.Handle("/", svc.Handler()) logrus.WithField("port", config.Port).Info("starting server") if err := http.ListenAndServe(":"+config.Port, nil); err != nil { logrus.WithError(err).Fatalf("something went wrong") } }
  • 53. api.go package main import ( // ... ) func (s Service) Handler() *mux.Router { r := mux.NewRouter() r.PathPrefix("/api") r.HandleFunc("/v1/import", s.importHandler).Methods("POST") return r }
  • 54. api.go package main import ( // ... ) func (s Service) Handler() *mux.Router { r := mux.NewRouter() r.PathPrefix("/api") r.HandleFunc("/v1/import", s.importHandler).Methods("POST") return r }
  • 55. api.go type ImportInput struct { Assembly string `json:"assembly,omitempty"` Vcf string `json:"vcf,omitempty"` } func importHandler(w http.ResponseWriter, r *http.Request) { var input ImportInput json.NewDecoder(r.Body).Decode(&input) client, _ := faktory.Open() defer client.Close() job := faktory.NewJob("dx", input.Assembly, input.Vcf) client.Push(job) w.WriteHeader(http.StatusOK) }
  • 56. api.go type ImportInput struct { Assembly string `json:"assembly,omitempty"` Vcf string `json:"vcf,omitempty"` } func importHandler(w http.ResponseWriter, r *http.Request) { var input ImportInput json.NewDecoder(r.Body).Decode(&input) client, _ := faktory.Open() defer client.Close() job := faktory.NewJob("dx", input.Assembly, input.Vcf) client.Push(job) w.WriteHeader(http.StatusOK) }
  • 57. api.go type ImportInput struct { Assembly string `json:"assembly,omitempty"` Vcf string `json:"vcf,omitempty"` } func importHandler(w http.ResponseWriter, r *http.Request) { var input ImportInput json.NewDecoder(r.Body).Decode(&input) client, _ := faktory.Open() defer client.Close() job := faktory.NewJob("dx", input.Assembly, input.Vcf) client.Push(job) w.WriteHeader(http.StatusOK) }
  • 58. main.go package main import ( // ... ) func main() { // running workers in background go func() { worker.Run() }() // configure API handlers svc := api.New() http.Handle("/", svc.Handler()) logrus.WithField("port", config.Port).Info("starting server") if err := http.ListenAndServe(":"+config.Port, nil); err != nil { logrus.WithError(err).Fatalf("something went wrong") } }
  • 59. worker.go package worker import ( // ) func Run() { logrus.Info("starting workers in background mode") svc := worker.NewManager() logrus.WithField("jobType", "dx").Info("register job") svc.Register("dx", dxWorker) logrus.Info("waiting for jobs") svc.Run() }
  • 60. func dxWorker(ctx worker.Context, args ...interface{}) error { var ( assembly = args[0].(string) vcf = args[1].(string) ) cmd := exec.Command("vsa", "dx", "--assembly", assembly, "--vcf", vcf) stderr, err := cmd.StderrPipe() if err != nil { return err } if err := cmd.Start(); err != nil { return err } rerr, _ := ioutil.ReadAll(stderr) if err := cmd.Wait(); err != nil { return fmt.Errorf("%s", rerr) } return nil }
  • 61. func dxWorker(ctx worker.Context, args ...interface{}) error { var ( assembly = args[0].(string) vcf = args[1].(string) ) cmd := exec.Command("vsa", "dx", "--assembly", assembly, "--vcf", vcf) stderr, err := cmd.StderrPipe() if err != nil { return err } if err := cmd.Start(); err != nil { return err } rerr, _ := ioutil.ReadAll(stderr) if err := cmd.Wait(); err != nil { return fmt.Errorf("%s", rerr) } return nil }
  • 62. func dxWorker(ctx worker.Context, args ...interface{}) error { var ( assembly = args[0].(string) vcf = args[1].(string) ) cmd := exec.Command("vsa", "dx", "--assembly", assembly, "--vcf", vcf) stderr, err := cmd.StderrPipe() if err != nil { return err } if err := cmd.Start(); err != nil { return err } rerr, _ := ioutil.ReadAll(stderr) if err := cmd.Wait(); err != nil { return fmt.Errorf("%s", rerr) } return nil }
  • 63. func dxWorker(ctx worker.Context, args ...interface{}) error { var ( assembly = args[0].(string) vcf = args[1].(string) ) cmd := exec.Command("vsa", "dx", "--assembly", assembly, "--vcf", vcf) stderr, err := cmd.StderrPipe() if err != nil { return err } if err := cmd.Start(); err != nil { return err } rerr, _ := ioutil.ReadAll(stderr) if err := cmd.Wait(); err != nil { return fmt.Errorf("%s", rerr) } return nil }
  • 65. func dxWorker(ctx worker.Context, args ...interface{}) error { var ( assembly = args[0].(string) vcf = args[1].(string) ) cmd := exec.Command("vsa", "dx", "--assembly", assembly, "--vcf", vcf) stderr, err := cmd.StderrPipe() if err != nil { return err } if err := cmd.Start(); err != nil { return err } rerr, _ := ioutil.ReadAll(stderr) if err := cmd.Wait(); err != nil { return fmt.Errorf("%s", rerr) } return nil }
  • 67. Exemplo de call // payload.json { "assembly":"GRCh37", "vcf":"/home/marcosinger/files/FXM281-001.vcf.gz" }
  • 68. Exemplo de call curl -XPOST -H "Content-Type: application/json" --data @payload.json http://host:port/api/v1/import
  • 69. 15 exames/hora 5 máquinas c4.4xlarge Amazon SQS MongoDB Elasticsearch
  • 70. 200 exames/hora 1 máquina t2.large Faktory MongoDB