Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ゆっくり動くと速く動ける / If you move slowly, you can move more fast

ゆっくり動くと速く動ける / If you move slowly, you can move more fast

Ruby on Railsの抽象インタフェース(ActiveRecord/ActiveJob)を使うことで、アプリケーションのアーキテクチャ決定を遅らせる事ができる。アーキテクチャの決定を遅らせ、アプリケーションの構成をなるべく長い期間シンプルに保つと、開発速度を上げることができます。
Rails Developers Meetup 2018 Day 4 Nouvelle Vague https://techplay.jp/event/702297 にて発表

shigeru. nakajima

December 08, 2018
Tweet

More Decks by shigeru. nakajima

Other Decks in Technology

Transcript

  1. ӳจ͸ߏจղੳͰ͖Δ Which genes are associated with Endothelin receptor type B?

    genes Endothelin receptor type B associated with ߋʹURIʹม׵
  2. SPARQLΛੜ੒ SELECT ?it1 ?st1 ?p01 WHERE { ?it1 ?st1 <http://www4.wiwiss.fu-berlin.de/diseasome/resource/diseasome/genes>

    . <http://www4.wiwiss.fu-berlin.de/drugbank/resource/targets/578> ?p01 ?it1 . FILTER (isIRI(?it1)) FILTER (?p01 NOT IN (<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://www.w3.org/2000/01/rdf-schema#subClassOf>, <http://www4.wiwiss.fu-berlin.de/diseasome/resource/diseasome/class>, <http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/drugType>, <http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/drugCategory>, <http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/dosageForm>)) FILTER (?st1 IN (<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, <http://www.w3.org/2000/01/rdf-schema#subClassOf>, <http://www4.wiwiss.fu-berlin.de/diseasome/resource/diseasome/class>, <http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/drugType>, <http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/drugCategory>, <http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugbank/dosageForm>)) } LIMIT 10 100ʙ1000ݸੜ੒͞ΕΔ
  3. ݕࡧۭؒ SPARQL͸άϥϑΛͨͲΔ ࢦ਺ؔ਺తʹݕࡧۭ͕ؒ૿͑Δ 100 x 100 x 100 … ਺ສʙ10ԯϨίʔυˏone

    DB ओޠ- ड़ޠ ->໨తޠ = = GraphQLʹͪΐͬͱࣅ͍ͯΔ ओޠ- ड़ޠ ->໨తޠ ओޠ- ड़ޠ ->໨తޠ
  4. ݕࡧ࣌ؒྫ Which genes are associated with Endothelin receptor type B?

    => 40 ඵ What drugs are associated with strokes and arthrosis? => 10෼30ඵ
  5. docker-compose ϦϙδτϦ͕ࢦఆͰ͖Δ
 
 
 
 
 
 ϞϊϨϙ͍Βͳ͍ version: '3'

    services: lodqa_bs: build: https://github.com/lodqa/lodqa_bs.git lodqa_email_agent: build: . depends_on: - lodqa_bs
  6. Dockerfileͷίπ entory-point Ͱ db:migrate ͢Δ
 
 
 
 
 ιʔείʔυɾϑΝΠϧΛίϯςφʹίϐʔ͢Δ

    #!/bin/sh set -e if [ $1 = 'bin/rails' ] && [ $2 = 's' ] ; then rm -f ./tmp/pids/server.pid bin/rails db:migrate fi exec "$@" RUN mkdir -p /usr/src/myapp WORKDIR /usr/src/myapp COPY . ./
  7. ϞϯΩʔύον module SuckerPunch module Job module ClassMethods def perform_async *_args,

    &block return unless SuckerPunch::RUNNING.true? queue = SuckerPunch::Queue.find_or_create to_s, num_workers, num_jobs_max queue.post { __run_perform(&block) } end def __run_perform SuckerPunch::Counter::Busy.new(to_s).increment result = yield SuckerPunch::Counter::Processed.new(to_s).increment result rescue StandardError => ex SuckerPunch::Counter::Failed.new(to_s).increment SuckerPunch.exception_handler.call ex, self, args ensure SuckerPunch::Counter::Busy.new(to_s).decrement end end end end module ActiveJob module QueueAdapters class SuckerPunchAdapter def enqueue job job.queue_name = job.class.to_s job.class.perform_async { Base.execute job.serialize } end end end end