Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update spark to 3.0.0 & add notebook image option #169

Merged
merged 2 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions bin/cowait
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,15 @@ def agent(ctx, cluster: str, detach: bool, upstream: str):
type=bool, is_flag=True,
help='build and push first',
default=False)
@click.option('-i', '--image',
type=str,
default=None,
help='default image')
@click.pass_context
def notebook(ctx, cluster, build):
def notebook(ctx, cluster, build, image):
if cluster is not None:
ctx.obj.default_cluster = cluster
cowait.cli.notebook(ctx.obj, build)
cowait.cli.notebook(ctx.obj, build, image)


#
Expand Down
7 changes: 5 additions & 2 deletions cowait/cli/commands/notebook.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from .run import run as run_cmd


def notebook(config, build):
def notebook(config, build, image = None):
task = 'cowait.notebook'
if image is not None:
task = f'{image}/{task}'
return run_cmd(
config=config,
task='cowait.notebook',
task=task,
build=build,
routes={
'/': '8888',
Expand Down
3 changes: 2 additions & 1 deletion cowait/tasks/spark/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


class SparkWorker(ShellTask):
async def run(self, master: str, cores: int = 2) -> dict:
async def run(self, master: str, cores: int = 2, memory = '4G') -> dict:
return await super().run(
command=' '.join([
'spark-class',
Expand All @@ -11,5 +11,6 @@ async def run(self, master: str, cores: int = 2) -> dict:
]),
env={
'SPARK_WORKER_CORES': str(cores),
'SPARK_WORKER_MEMORY': memory,
},
)
2 changes: 1 addition & 1 deletion images/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ version: '2'
services:
spark:
build: './spark'
image: 'cowait/task-spark'
image: 'cowait/spark'
4 changes: 2 additions & 2 deletions images/spark/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ RUN apt-get update && apt-get install -y wget default-jre-headless
ENV JAVA_HOME=/usr/lib/jvm/default-java

# install spark
ENV SPARK_VERSION=3.0.0-preview2
ENV SPARK_VERSION=3.0.0
ENV HADOOP_VERSION=3.2
ENV PY4J_VERSION=0.10.8.1
ENV PY4J_VERSION=0.10.9

RUN wget \
-O spark.tgz https://www-eu.apache.org/dist/spark/spark-${SPARK_VERSION}/spark-${SPARK_VERSION}-bin-hadoop${HADOOP_VERSION}.tgz \
Expand Down