<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by roy hasson on Medium]]></title>
        <description><![CDATA[Stories by roy hasson on Medium]]></description>
        <link>https://medium.com/@royhasson?source=rss-f212a8a460b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*pj871qpkk9j5FRHq.jpg</url>
            <title>Stories by roy hasson on Medium</title>
            <link>https://medium.com/@royhasson?source=rss-f212a8a460b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 14:59:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@royhasson/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Running Spark 2.0 Preview on EMR]]></title>
            <link>https://medium.com/@royhasson/running-spark-2-0-preview-on-emr-635081e01341?source=rss-f212a8a460b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/635081e01341</guid>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[emr]]></category>
            <category><![CDATA[spark-2]]></category>
            <dc:creator><![CDATA[roy hasson]]></dc:creator>
            <pubDate>Fri, 01 Jul 2016 03:21:21 GMT</pubDate>
            <atom:updated>2016-07-01T03:23:24.360Z</atom:updated>
            <content:encoded><![CDATA[<p>Spark 2.0 Preview was released on May 2016 to a lot of fanfare. <a href="https://databricks.com/">Databricks</a> and the Spark Summit did an amazing job at showcasing the new functionality and describing the performance improvements we can expect to see.</p><p>I’ve been playing around with Spark 2.0 Preview inside a Docker <a href="https://hub.docker.com/r/gettyimages/spark/">container</a> for a little while now testing out the new features in pyspark shell.</p><p>I decided it was time to run some test applications on EMR but since Spark 2.0 is not GA, EMR doesn’t support it yet. So what to do? Lets try to get Spark 2.0 Preview running on EMR using what’s called “bootstrap-actions”.</p><p>EMR consists of a set of predefined applications such as Hadoop, Spark, Pig, Hive, etc. that are automatically launched for you on a set of EC2 instances in AWS. But how do we replace the default Spark 1.6 with 2.o-preview?</p><p>Thanks to the Spark team, we don’t need to bother with compiling and building a custom distribution. We simple goto the <a href="https://spark.apache.org/downloads.html">Spark download page</a> and select “2.0.0-preview” as our Spark release, select “Pre-built for Hadoop 2.7 or later” as the package type and download the tarball to our local machine.</p><p>Now the hard part, well not really. We need to create an S3 bucket (or use an existing one). I won’t go into how to install the AWS CLI, but you can find instructions <a href="http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html">here</a>. To create an S3 bucket you simple run the following command:</p><pre>aws s3api create-bucket --bucket your-bucket-name --region us-east-1</pre><p>Now that you have a bucket you can copy the Spark 2.0 file you downloaded to the bucket. You can do it with this simple command:</p><pre>aws s3 cp spark-2.0.0-preview-bin-hadoop2.7.tgz s3://your-bucket-name</pre><p>Next we need to create a custom configuration file for EMR to use so that it can pick our Spark 2.0 distribution file instead of the default one. To do that we need to create a file called “config.file”. You can find it in this <a href="https://gist.github.com/rhasson/43caaeb46ee18113005bfda24d758a19">gist</a>. It’s pretty self explanatory but the fields to pay attention to are fields 2 and 5. Field 2 simply defines the Spark build version. Field 5 is more important and is the S3 bucket and filename where the Spark 2.0 distribution is stored. Remember you downloaded this file from the Spark website and then copied it to S3?</p><p>Once you update the config.file to reflect your bucket name, copy it to your S3 bucket. Just remember the fields are TAB separated.</p><p>That’s it for the setup part, now lets create a small cluster. With EMR when creating a cluster we need to define some basic parameters. We’ll leave most to default. Here is the CLI command to use:</p><pre>aws emr create-cluster --name Spark2Cluster --ami-version 3.11.0 --ec2-attributes KeyName=YourSSHKeyName --use-default-roles --instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m3.xlarge InstanceGroupType=CORE,InstanceCount=2,InstanceType=m3.xlarge --bootstrap-actions Path=s3://support.elasticmapreduce/spark/install-spark,Args=[&quot;-cs3://your-bucket-name/config.file&quot;,&quot;-v2.0&quot;] --no-auto-terminate --enable-debugging --log-uri s3://your-bucket-name</pre><p>I know I know it looks complicated. Let me break it down. First when creating a cluster we want to give it a name, hence the “ — name” argument. Next we select an AMI version. 3.11.0 is good enough for what we’re trying to do. The “ec2-attributes” argument allows you to setup different EC2 parameters, in this case we’re setting the SSH key to use when trying to SSH into any of the nodes. Make sure you set this to point to your SSH key that you’ve configured in your AWS console. The “instance-groups” argument defines two types of instance group types, Master and Core. In our case we’re creating 1 Master and 2 Core nodes. All nodes will be using the m3.xlarge EC2 instance type, but feel free to change this if you feel you need more horsepower from your cluster.</p><p>Now we come to the “bootstrap-actions”. Bootstrap actions are just scripts that each node in the cluster will run as it comes up. In our case we want to run the install-spark script that AWS was nice enough to create for us. We do however need to pass in a couple arguments. The first one “-c” tells the install script where it can find the configuration file. This is of course the one we created and uploaded to our S3 bucket earlier. The “-v” tells the script which version to select from the config.file since you may have multiple versions listed.</p><p>The last part of the create-cluster command enables debugging and saves all the logs to our S3 bucket. This is very handy when troubleshooting cluster bootstrapping and other issues.</p><p>By this time your cluster should be up and running. You can check by running the following command, substituting your cluster ID.</p><pre>aws emr describe-cluster --cluster-id j-xxxxxxxxxxxxx</pre><p>In the cluster status section of the response you should see something like:</p><pre>&quot;State&quot;: &quot;WAITING&quot;</pre><p>Now the cluster is up and running and waiting for you to create a step, also known as a job which basically means run your application on your new cluster. So lets do that.</p><p>I won’t spend time on how to create a Spark application, there are plenty of documentation and tutorials on that topic so I’ll assume you already have an application ready.</p><p>This is how we add a step to our EMR cluster so that it can run our script.</p><pre>aws emr add-steps --cluster-id j-xxxxxxxxxxxxx --steps Name=MySparkJob,Jar=s3://us-east-1.elasticmapreduce/libs/script-runner/script-runner.jar,Args=[/home/hadoop/spark/bin/spark-submit,--deploy-mode,cluster,s3://your-bucket-name/mySparkApplication.py],ActionOnFailure=CONTINUE</pre><p>And that’s it. You’re running your application on Spark 2.0 Preview.</p><p>Oh hey, maybe you wanted to launch the Spark shell? SSH into the master node and type “pyspark” (yes I prefer Python). After all the logs have rolled through you should see the Spark logo. Go ahead and check the version:</p><pre>Welcome to<br>      ____              __<br>     / __/__  ___ _____/ /__<br>    _\ \/ _ \/ _ `/ __/  &#39;_/<br>   /__ / .__/\_,_/_/ /_/\_\   version 2.0.0-preview<br>      /_/</pre><pre>&gt;&gt;&gt; sc.version<br>u&#39;2.0.0-preview’</pre><p>Now remember, Spark 2.0 Preview is not officially supported by AWS so do this at your own risk. Also note that we didn’t really tweak any of the Spark parameters such as memory, CPU, etc. so I wouldn’t recommend running this for any production workloads.</p><p>Roy</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=635081e01341" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitBox]]></title>
            <link>https://medium.com/@royhasson/gitbox-92272952b06b?source=rss-f212a8a460b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/92272952b06b</guid>
            <dc:creator><![CDATA[roy hasson]]></dc:creator>
            <pubDate>Fri, 25 Oct 2013 18:50:21 GMT</pubDate>
            <atom:updated>2013-10-25T18:50:21.887Z</atom:updated>
            <content:encoded><![CDATA[<h4>Git driven DropBox clone</h4><p>In my day job I create a lot of documents and presentations that I share internally for review and feedback before sharing with my customers for their feedback. Many times I start off from previous documents, removing irrelevant pieces, shuffling around other sections and finally adding new content. At the end of the day I end up with tens of files documenting my evolution towards the final version to be published.</p><p>In my spare time I develop Web applications and services for fun. I mainly develop in Javascript and Node.js which I really enjoy. My familiarity with Git and Github is very functional but I’m by no means an expert. I recognize the value of a clean Git workflow to software development.</p><p>GitBox is an idea I came up with to alleviate the challenge of document creation and version control. Rather than updating documents and naming them based on a superficial version number or a timestamp which provides no hint as to what was actually changed, why not use Git for version control and commit comments and history. On top of being to locally manage documents, the user can push them to GitBox cloud server, GitHub or a locally hosted GitBox instance. This enables collaboration if the form of Git pull requests, GitHub inspired WebHooks for change notification as well as reduce the number of files people send and store in their inbox (I’m afraid to even check the size of my Oulook PST file).</p><p>So I set off to prototype GitBox. Thankfully Tim Caswell (@creationix) created JS-Git ( <a href="https://github.com/creationix/js-git">https://github.com/creationix/js-git</a> ). So I created a simple process that monitored a working directory for changes. Every time a file or directory was added or updated a new commit was created. Later I was able to walk the commit history and restore older version of files and then go back.</p><p>That’s all nice and simple, the hard part comes when I started thinking about how I will use it in my day to day job. I needed a simple and quick way to checkpoint my changes at relevant places that made sense to me and to the document I’m creating. Issuing a commit every time Word decides to auto-save the document is going to create a massive commit history that’s unusable. I needed a better way. Sorry to disappoint you but I’m still thinking about this one…</p><p>Next post I’ll talk about how I created the initial prototype.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92272952b06b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>