Skip to content

Commit

Permalink
release 2.0.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilumeshsargur committed Mar 4, 2024
1 parent 2c74615 commit dd8ccde
Show file tree
Hide file tree
Showing 34 changed files with 548 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/test_artifacts/v2/altair.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

CMD ["python", "-c", "import altair"]

RUN sudo apt-get update && \
sudo apt-get install -y git && \
git clone --recursive https://github.com/altair-viz/altair_notebooks.git && \
:

WORKDIR "altair_notebooks/notebooks"
COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_altair_example_notebooks.sh ./
RUN chmod +x run_altair_example_notebooks.sh

# Example notebooks' dependencies
RUN micromamba install -y --freeze-installed -c conda-forge papermill vega_datasets pandas matplotlib numpy

CMD ["./run_altair_example_notebooks.sh"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

CMD ["python", "-c", "import amazon_codewhisperer_jupyterlab_ext"]
13 changes: 13 additions & 0 deletions test/test_artifacts/v2/autogluon.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE as base

ARG MAMBA_DOCKERFILE_ACTIVATE=1

RUN micromamba install --freeze-installed -y -c conda-forge pytest

RUN git clone --recursive https://github.com/autogluon/autogluon.git

WORKDIR "autogluon"
COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_autogluon_tests.sh .
RUN chmod +x run_autogluon_tests.sh
CMD ["./run_autogluon_tests.sh"]
91 changes: 91 additions & 0 deletions test/test_artifacts/v2/aws-glue-sessions/glue_notebook.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "1a710e7c-7ebf-477a-88b5-3d85cb08cf19",
"metadata": {},
"outputs": [],
"source": [
"%status"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0ce599e8-6dcc-42c4-b10d-8e4e898eb436",
"metadata": {},
"outputs": [],
"source": [
"%stop_session"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "013565d2-26dc-4710-83ca-1d00711be6c9",
"metadata": {},
"outputs": [],
"source": [
"%glue_ray"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e81bb7c2-bec2-4c4b-8d4d-59bf5e6a9daf",
"metadata": {},
"outputs": [],
"source": [
"%etl"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7a0b5de5-bf14-40f9-a944-f98e5a96e0f4",
"metadata": {},
"outputs": [],
"source": [
"%streaming"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cf24f505-6f26-447e-acc3-4af4556bb386",
"metadata": {},
"outputs": [],
"source": [
"%help"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "33149d30-420e-4ebf-b32c-ca635db7cb10",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Glue PySpark and Ray",
"language": "python",
"name": "glue_pyspark"
},
"language_info": {
"codemirror_mode": {
"name": "python",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "Python_Glue_Session",
"pygments_lexer": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Create an empty notebook file for papermill's output
touch nb_output.ipynb

kernels=('glue_pyspark' 'glue_spark')
nb='script'
for kernel in ${kernels[@]}; do
papermill 'glue_notebook.ipynb' 'nb_output.ipynb' -k $kernel
done

15 changes: 15 additions & 0 deletions test/test_artifacts/v2/boto3.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1
RUN sudo apt-get update && sudo apt-get install -y git && \
git clone --recursive https://github.com/boto/boto3.git && \
:

# For Running boto3 tests, we need pytest
RUN micromamba install -y --freeze-installed -c conda-forge pytest

WORKDIR "boto3"
COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_boto3_tests.sh .
RUN chmod +x run_boto3_tests.sh
CMD ["./run_boto3_tests.sh"]
13 changes: 13 additions & 0 deletions test/test_artifacts/v2/glue-sessions.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

COPY --chown=$MAMBA_USER:$MAMBA_USER aws-glue-sessions/run_glue_sessions_notebook.sh .
RUN chmod +x run_glue_sessions_notebook.sh
COPY --chown=$MAMBA_USER:$MAMBA_USER aws-glue-sessions/glue_notebook.ipynb .
RUN chmod +x glue_notebook.ipynb

RUN micromamba install -y --freeze-installed -c conda-forge papermill

CMD ["./run_glue_sessions_notebook.sh"]
6 changes: 6 additions & 0 deletions test/test_artifacts/v2/jupyter-ai.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

CMD ["python", "-c", "import jupyter_ai"]
6 changes: 6 additions & 0 deletions test/test_artifacts/v2/jupyter-dash.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

CMD ["python", "-c", "import plotly.express as px; import sys; fig = px.bar(x=['a', 'b', 'c'], y=[1, 3, 2]); fig.write_html('first_figure.html', auto_open=False)"]
7 changes: 7 additions & 0 deletions test/test_artifacts/v2/jupyterlab-git.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

CMD ["python", "-c", "import jupyterlab_git"]

7 changes: 7 additions & 0 deletions test/test_artifacts/v2/jupyterlab-lsp.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

CMD ["python", "-c", "import jupyter_lsp"]
CMD ["python", "-c", "import jupyterlab_lsp"]
25 changes: 25 additions & 0 deletions test/test_artifacts/v2/keras.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

RUN sudo apt-get update && sudo apt-get install -y git graphviz && \
git clone --recursive https://github.com/keras-team/keras-io.git && \
:

# Some of the keras guides requires pydot and graphviz to be installed
RUN micromamba install -y --freeze-installed conda-forge::pydot nvidia::cuda-nvcc
ENV XLA_FLAGS=--xla_gpu_cuda_data_dir=/opt/conda

WORKDIR "keras-io/guides"

# Checkout a specific commit known to be compatible with the runtime's current version of TensorFlow.
# keras-io made backwards incompatible changes that broke these tests. Pinning at this commit for now
# at least until the runtime's TensorFlow dependency is upgraded to the next minor version
RUN git checkout 861b59747b43ce326bb0a12384a07d6632249901

COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_keras_tests.sh .
RUN chmod +x run_keras_tests.sh
# Run tests in run_keras_tests.sh
CMD ["./run_keras_tests.sh"]

19 changes: 19 additions & 0 deletions test/test_artifacts/v2/matplotlib.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

RUN sudo apt-get update && sudo apt-get install -y git && \
git clone --recursive https://github.com/matplotlib/matplotlib.git && \
:

# TODO: Come up with a different way to test matplotlib installation.
# Currently we will be running all the python files in galleries/tutorials
# But this directory structure might change in the future. In the past, "galleries/tutorials"
# didn't exist. Previously the repository just had a "tutorials" folder.
WORKDIR "matplotlib/galleries/tutorials"
COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_matplotlib_tests.sh .
RUN chmod +x run_matplotlib_tests.sh
# Run tests in run_matplotlib_tests.sh
CMD ["./run_matplotlib_tests.sh"]

6 changes: 6 additions & 0 deletions test/test_artifacts/v2/notebook.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

CMD ["python", "-c", "import notebook"]
13 changes: 13 additions & 0 deletions test/test_artifacts/v2/numpy.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

# Inorder to test numpy, we need pytest and hypothesis to be installed.
RUN micromamba install -y --freeze-installed -c conda-forge pytest hypothesis meson
# Some unit tests in numpy requires gcc to be installed.
RUN sudo apt-get update && sudo apt-get install -y gcc
# Check https://numpy.org/doc/stable/reference/testing.html
# numpy.test() returns True if tests succeed else False.
# We need to flip the result so that we exit with status code as 0 if all the tests succeeded.
CMD ["python", "-c", "import numpy,sys; tests_succeeded = numpy.test(); sys.exit(not tests_succeeded)"]
8 changes: 8 additions & 0 deletions test/test_artifacts/v2/pandas.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1
RUN micromamba install -y --freeze-installed -c conda-forge pytest hypothesis pytest-asyncio lxml

COPY --chown=$MAMBA_USER:$MAMBA_USER run_pandas_tests.py .
CMD ["python", "run_pandas_tests.py"]
7 changes: 7 additions & 0 deletions test/test_artifacts/v2/python-lsp-server.test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

# "Confirm that installation succeeded" by running this - https://github.com/python-lsp/python-lsp-server#installation
CMD ["pylsp", "--help"]
20 changes: 20 additions & 0 deletions test/test_artifacts/v2/pytorch.examples.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1
RUN sudo apt-get update && \
sudo apt-get install -y git && \
git clone --recursive https://github.com/pytorch/examples && \
:

WORKDIR "examples"

# There is a line in run_python_examples.sh which looks like: BASE_DIR=`pwd`"/"`dirname $0`
# When we run the shell script through /usr/local/bin/_entrypoint.sh, that line above doesn't work correctly. In our
# case, we properly set `pwd` to the directory that contains all the examples, so we just modify the script to change
# the previous line to look like: BASE_DIR=`pwd`
RUN sed -i 's/^BASE_DIR=.*pwd.*dirname.*/BASE_DIR=`pwd`/' run_python_examples.sh
RUN ./run_python_examples.sh install_deps

# We skip `imagenet` because it requires a lot of resources and so aren't a good fit for us.
CMD ["./run_python_examples.sh", "dcgan,fast_neural_style,distributed,mnist,mnist_forward_forward,mnist_hogwild,mnist_rnn,regression,reinforcement_learning,siamese_network,super_resolution,time_sequence_prediction,vae,word_language_model,fx"]
23 changes: 23 additions & 0 deletions test/test_artifacts/v2/run_pandas_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import pandas, sys, os, site

# We change the working directory here because there is at least one test (`test_html_template_extends_options`) which
# expects the directory to be 'pandas'. Ideally, we would have changed directories through a `WORKDIR` in Dockerfile
# but unfortunately it doesn't accept dynamic arguments.
site_packages_dir = site.getsitepackages()[0]
os.chdir(site_packages_dir)

# pandas.test() by default runs with `-m "not slow and not network and not db"`. However, we found a few tests in the
# test_network.py file that should have been marked as "network" but weren't, so we skip those here. We skip S3 specific
# tests for the same reason.
# We skip `test_plain_axes` too: the Pandas dev environment expects matplotlib to be ">=3.6.1, <3.7.0" but the runtime
# expectation is just ">=3.6.1". Our image contains v3.7.1, so it meets the latter requirement but not the former. This
# particular test, however, only works with the former requirement. (We verified that the test succeeds if we manually
# drop the version to v3.6.x) So, we skip it.
# Also skipping specific TestFrameFlexArithmetic test; failing due to known issue https://github.com/pandas-dev/pandas/issues/54546
tests_succeeded = pandas.test([
'-m', '(not slow and not network and not db)',
'-k', '(not test_network and not s3 and not test_plain_axes)',
'--no-strict-data-files',
'--ignore', 'pandas/tests/frame/test_arithmetic.py::TestFrameFlexArithmetic::test_floordiv_axis0_numexpr_path'])

sys.exit(not tests_succeeded)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

# Execute the unit tests for sagemaker-headless-execution-driver
CMD ["python", "-c", "import sagemaker_headless_execution_driver.headless_execution as execution_driver"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG COSMOS_IMAGE
FROM $COSMOS_IMAGE

ARG MAMBA_DOCKERFILE_ACTIVATE=1

COPY --chown=$MAMBA_USER:$MAMBA_USER ./sagemaker-studio-analytics-extension .
RUN chmod +x ./sagemaker-studio-analytics-extension.sh

RUN micromamba install -y --freeze-installed -c conda-forge papermill

CMD ["./sagemaker-studio-analytics-extension.sh"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
papermill 'sagemaker_studio_analytics_extension.ipynb' 'nb_output.ipynb'
Loading

0 comments on commit dd8ccde

Please sign in to comment.