Add --allow-privileged=true
to:
# kubelet config
sudo vim /var/snap/microk8s/current/args/kubelet
#kube-apiserver config
sudo vim /var/snap/microk8s/current/args/kube-apiserver
Restart services:
import cats.effect.Sync | |
import io.chrisdavenport.log4cats.Logger | |
import cats._ | |
import cats.implicits._ | |
import scala.concurrent.duration._ | |
class RetryExample[F[_]](implicit F: Sync[F], log: Logger[F]) { | |
case class ApiError(msg: String) extends Exception(msg) | |
private def getTempFromInternet: EitherT[F, ApiError, Float] = ??? |
Add --allow-privileged=true
to:
# kubelet config
sudo vim /var/snap/microk8s/current/args/kubelet
#kube-apiserver config
sudo vim /var/snap/microk8s/current/args/kube-apiserver
Restart services:
import com.typesafe.config.Config | |
implicit class ImplicitConfigHelper(val c: Option[Config]) extends AnyVal { | |
import scala.reflect.ClassTag | |
import scala.util.control.NonFatal | |
import ImplicitConfigHelper._ | |
implicit def valueOf[T : ClassTag](prop: String)(implicit ev: ClassTag[T]) : T = | |
ev.runtimeClass match { // you need stable identifiers here | |
case String_ => c.get.getString(prop).asInstanceOf[T] | |
case Int_ => c.get.getInt(prop).asInstanceOf[T] |
This is a non-XA pattern that involves a synchronized single-phase commit of a number of resources. Because the 2PC is not used, it can never be as safe as an XA transaction, but is often good enough if the participants are aware of the compromises. The basic idea is to delay the commit of all resources as late as possible in a transaction so that the only thing that can go wrong is an infrastructure failure (not a business-processing error). Systems that rely on Best Efforts 1PC reason that infrastructure failures are rare enough that they can afford to take the risk in return for higher throughput. If business-processing services are also designed to be idempotent, then little can go wrong in practice.
Consider a jms based service, where there is an inbound Queue manager (QM1), an outbound queue manager (QM2) and a database (DB). Here are the scenarios that I would like to cover using Best efforts 1 PC commit process:
import akka.actor.ActorSystem | |
import akka.stream._ | |
import akka.stream.scaladsl._ | |
import scala.io.StdIn | |
import scala.util.Random | |
object SimplePartitionSample extends App { | |
implicit val system = ActorSystem() |
To be able to use custom endpoints with the latest Spark distribution, one needs to add an external package (hadoop-aws
). Then, custum endpoints can be configured according to docs.
bin/spark-shell --packages org.apache.hadoop:hadoop-aws:2.7.2
mkdir -p ~/.ammonite && wget -O ~/.ammonite/predef.scala --no-check-certificate https://git.io/v6r5y | |
wget -O amm --no-check-certificate https://git.io/vioDM && chmod u+x amm && ./amm |
import shapeless._ | |
import scalaz._ | |
import Scalaz._ | |
object console extends App { | |
trait Foo[A] { | |
type B | |
def value: B |
import java.security.MessageDigest | |
import java.util | |
import javax.crypto.Cipher | |
import javax.crypto.spec.SecretKeySpec | |
import org.apache.commons.codec.binary.Base64 | |
/** | |
* Sample: | |
* {{{ | |
* scala> val key = "My very own, very private key here!" |