Skip to content

Instantly share code, notes, and snippets.

View scottfrazer's full-sized avatar
👋

Scott Frazer scottfrazer

👋
View GitHub Profile
"""
1)
Given a 2D list of integers where each row and column is sorted in ascending
order from left to right and top to bottom...
e.g.
"""
"""
Write a method that checks for the number occurrences of an integer in the matrix.
@scottfrazer
scottfrazer / a.go
Last active July 29, 2016 13:20
Go Examples
/* Go's "hello world" */
package main
import "fmt"
func main() {
fmt.Println("hello world")
}

Go vs. Scala (Akka) Concurrency

A comparison from 2 weeks using Go.

Actors vs. Functions

Akka's central principle is that there you have an ActorSystem which runs Actors. An Actor is defined as a class and it has a method to receive messages.

clean:
-rm DB kernel maple.log
compile:
go build kernel.go db.go log.go parse.go
package main
import (
"net/http"
"fmt"
"io/ioutil"
"strconv"
"strings"
"os"
"bufio"
[info] Loading global plugins from /Users/sfrazer/.sbt/0.13/plugins
[info] Loading project definition from /Users/sfrazer/projects/cromwell/project
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[info] Set current project to cromwell (in build file:/Users/sfrazer/projects/cromwell/)
[info] Compiling 2 Scala sources to /Users/sfrazer/projects/cromwell/engine/target/scala-2.11/classes...
[info] Running cromwell.Main run scatter.wdl -
[2016-05-25 11:47:02,566] [info] Slf4jLogger started
[2016-05-25 11:47:02,604] [info] RUN sub-command
workflow w {
Array[String] x = ["a", "b", "c"]
String z = "d"
call t as t0 {input: a=z} # a="d"
scatter (y in x) {
String z = y + "foo"
call t as t1 {input: a=y, b=z} # (for first shard) a="a", b="afoo"
task append_array {
Array[Int] input_array
Array[Int] elements_to_add
command {
python <<CODE
for x in [${sep="," input_array}]:
print(x)
for x in [${sep="," elements_to_add}]:
print(x)
CODE
/** PBE: the return value of WorkflowExecutionActorState is just temporary.
* This should probably return a Try[BackendJobDescriptor], Unit, Boolean,
* Try[ActorRef], or something to indicate if the job was started
* successfully. Or, if it can fail to start, some indication of why it
* failed to start
*/
private def startJob(call: Call, index: Option[Int], attempt: Int, inputs: Map[FullyQualifiedName, WdlValue]): WorkflowExecutionActorState = {
val jobKey = BackendJobDescriptorKey(call, index, attempt)
val jobDescriptor = BackendJobDescriptor(workflowDescriptor.backendDescriptor, jobKey, inputs)
val configDescriptor = BackendConfigurationDescriptor(ConfigFactory.parseString("{}"), ConfigFactory.load())

Formerly WorkflowBackendActorFactory, the new interface is BackendLifecycleActorFactory:

trait BackendLifecycleActorFactory {
  def getWorkflowInitializationActorProps(...): Option[Props] = ???
  def getJobExecutionActorProps(...): Props = ???
  def getWorkflowFinalizationActorProps(...): Option[Props] = ???
}