Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View manjotmona's full-sized avatar
🎯
Focusing

Manjot Kaur manjotmona

🎯
Focusing
View GitHub Profile
class AkkaJobScheduler
{
def run : Cancellable =
{
val system = akka.actor.ActorSystem("system")
val simpleJob = system.actorOf(SimpleJob.props(), "simple-job")
system.scheduler.schedule(0 milliseconds,50 milliseconds, simpleJob, "foo")
}
}
object SimpleJob
{
def props(): Props = Props(new SimpleJob)
case object JobToDo
}
class SimpleJob extends Actor with LoggerHelper
{
override def receive =
class RestSpec extends WordSpec with Matchers with ScalatestRouteTest with MockitoSugar {
val mockUserImpl = mock[UserImpl]
object TestObject extends RestService {
val userImpl = mockUserImpl
}
"The service" should {
trait RestService {
implicit val userFormat = jsonFormat2(User)
val userImpl: UserImpl
val route =
post {
path("adduser") {
entity(as[User]) { user =>
val saved: Future[Done] = userImpl.addUser(user)
trait Block[P <: Proposition, TX <: Transaction[P]]
extends TransactionsCarryingPersistentNodeViewModifier[P, TX] {
def version: Version
def timestamp: Timestamp
}
object Block {
type BlockId = ModifierId
type Timestamp = Long
type Version = Byte
trait SyncInfo extends BytesSerializable {
def startingPoints: History.ModifierIds
}
trait History[PM <: PersistentNodeViewModifier, SI <: SyncInfo, HT <: History[PM, SI, HT]] extends HistoryReader[PM, SI] {
def append(modifier: PM): Try[(HT, ProgressInfo[PM])]
def reportModifierIsValid(modifier: PM): HT
def reportModifierIsInvalid(modifier: PM, progressInfo: ProgressInfo[PM]): (HT, ProgressInfo[PM])
def getReader: HistoryReader[PM, SI] = this
}
trait Box[P <: Proposition] extends BytesSerializable {
val value: Box.Amount
val proposition: P
val id: ADKey
}
object Box {
type Amount = Long
}
trait NodeViewHolder[P <: Proposition, TX <: Transaction[P], PMOD <: PersistentNodeViewModifier]
extends Actor with ScorexLogging {
type SI <: SyncInfo
type HIS <: History[PMOD, SI, HIS]
type MS <: MinimalState[PMOD, MS]
type VL <: Vault[P, TX, PMOD, VL]
type MP <: MemoryPool[TX, MP]
}
Question 1:
scala> val list = List("Hello,World")
list: List[String] = List(Hello,World)
scala> val rdd = sc.parallelize(list)
rdd: org.apache.spark.rdd.RDD[String] = ParallelCollectionRDD[2] at parallelize at <console>:26
scala> rdd.collect
res3: Array[String] = Array(Hello,World)