Skip to content

Commit

Permalink
Merge branch 'main' into abanuelos/update-webot-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dfremont committed Dec 13, 2024
2 parents 4764f0b + fe28e13 commit 94c7983
Show file tree
Hide file tree
Showing 62 changed files with 1,516 additions and 341 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/2-docs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Documentation
description: Report an issue or enhancement related to https://scenic-lang.readthedocs.io/
description: Report an issue or enhancement related to https://docs.scenic-lang.org/
labels:
- "type: documentation"
- "status: triage"
Expand All @@ -14,9 +14,9 @@ body:
attributes:
label: Describe the doc issue or enhancement
description: >
Please provide a clear and concise description of what content in https://scenic-lang.readthedocs.io/ has an issue or needs enhancement.
Please provide a clear and concise description of what content in https://docs.scenic-lang.org/ has an issue or needs enhancement.
placeholder: |
Link to location in the docs: https://scenic-lang.readthedocs.io/
Link to location in the docs: https://docs.scenic-lang.org/
validations:
required: true

Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Questions
url: https://forms.gle/uUhQNuPzQrvvBFJX9
about: Send your questions via Google Form
url: https://forum.scenic-lang.org/
about: Post your questions on our community forum
142 changes: 80 additions & 62 deletions .github/workflows/run-simulators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,42 @@ jobs:
runs-on: ubuntu-latest
concurrency:
group: sim
outputs:
volume_id: ${{ steps.create_volume_step.outputs.volume_id }}
env:
INSTANCE_ID: ${{ secrets.AWS_EC2_INSTANCE_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
steps:
- name: Create Volume from Latest Snapshot and Attach to Instance
id: create_volume_step
run: |
# Retrieve the latest snapshot ID
LATEST_SNAPSHOT_ID=$(aws ec2 describe-snapshots --owner-ids self --query 'Snapshots | sort_by(@, &StartTime) | [-1].SnapshotId' --output text)
echo "Checking availability for snapshot: $LATEST_SNAPSHOT_ID"
# Wait for the snapshot to complete
aws ec2 wait snapshot-completed --snapshot-ids $LATEST_SNAPSHOT_ID
echo "Snapshot is ready."
# Create a new volume from the latest snapshot
volume_id=$(aws ec2 create-volume --snapshot-id $LATEST_SNAPSHOT_ID --availability-zone us-west-1b --volume-type gp3 --size 400 --throughput 250 --query "VolumeId" --output text)
echo "Created volume with ID: $volume_id"
# Set volume_id as output
echo "volume_id=$volume_id" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
# Wait until the volume is available
aws ec2 wait volume-available --volume-ids $volume_id
echo "Volume is now available"
# Attach the volume to the instance
aws ec2 attach-volume --volume-id $volume_id --instance-id $INSTANCE_ID --device /dev/sda1
echo "Volume $volume_id attached to instance $INSTANCE_ID as /dev/sda1"
- name: Start EC2 Instance
env:
INSTANCE_ID: ${{ secrets.AWS_EC2_INSTANCE_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
run: |
# Get the instance state
instance_state=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq -r '.Reservations[].Instances[].State.Name')
Expand All @@ -27,7 +56,7 @@ jobs:
sleep 10
instance_state=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq -r '.Reservations[].Instances[].State.Name')
done
# Check if instance state is "stopped"
if [[ "$instance_state" == "stopped" ]]; then
echo "Instance is stopped, starting it..."
Expand All @@ -42,34 +71,17 @@ jobs:
exit 1
fi
# wait for status checks to pass
TIMEOUT=120 # Timeout in seconds
START_TIME=$(date +%s)
END_TIME=$((START_TIME + TIMEOUT))
while true; do
response=$(aws ec2 describe-instance-status --instance-ids $INSTANCE_ID)
system_status=$(echo "$response" | jq -r '.InstanceStatuses[0].SystemStatus.Status')
instance_status=$(echo "$response" | jq -r '.InstanceStatuses[0].InstanceStatus.Status')
if [[ "$system_status" == "ok" && "$instance_status" == "ok" ]]; then
echo "Both SystemStatus and InstanceStatus are 'ok'"
exit 0
fi
CURRENT_TIME=$(date +%s)
if [[ "$CURRENT_TIME" -ge "$END_TIME" ]]; then
echo "Timeout: Both SystemStatus and InstanceStatus have not reached 'ok' state within $TIMEOUT seconds."
exit 1
fi
sleep 10 # Check status every 10 seconds
done
# Wait for instance status checks to pass
echo "Waiting for instance status checks to pass..."
aws ec2 wait instance-status-ok --instance-ids $INSTANCE_ID
echo "Instance is now ready for use."
check_simulator_version_updates:
name: check_simulator_version_updates
runs-on: ubuntu-latest
needs: start_ec2_instance
steps:
steps:
- name: Check for Simulator Version Updates
env:
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
Expand Down Expand Up @@ -109,11 +121,11 @@ jobs:
echo "NVIDIA Driver is not set"
exit 1
fi
'
'
- name: NVIDIA Driver is not set
if: ${{ failure() }}
run: |
echo "NVIDIA SMI is not working, please run the steps here on the instance:"
echo "NVIDIA SMI is not working, please run the steps here on the instance:"
echo "https://scenic-lang.atlassian.net/wiki/spaces/KAN/pages/2785287/Setting+Up+AWS+VM?parentProduct=JSW&initialAllowedFeatures=byline-contributors.byline-extensions.page-comments.delete.page-reactions.inline-comments.non-licensed-share&themeState=dark%253Adark%2520light%253Alight%2520spacing%253Aspacing%2520colorMode%253Alight&locale=en-US#Install-NVIDIA-Drivers"
run_carla_simulators:
Expand All @@ -128,17 +140,17 @@ jobs:
USER_NAME: ${{secrets.SSH_USERNAME}}
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} '
ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -i private_key ${USER_NAME}@${HOSTNAME} '
cd /home/ubuntu/actions/Scenic &&
source venv/bin/activate &&
carla_versions=($(find /software -maxdepth 1 -type d -name 'carla*')) &&
for version in "${carla_versions[@]}"; do
echo "============================= CARLA $version ============================="
echo "============================= CARLA $version ============================="
export CARLA_ROOT="$version"
pytest tests/simulators/carla/test_carla.py
pytest tests/simulators/carla
done
'
run_webots_simulators:
name: run_webots_simulators
runs-on: ubuntu-latest
Expand All @@ -160,42 +172,48 @@ jobs:
for version in "${webots_versions[@]}"; do
echo "============================= Webots $version ============================="
export WEBOTS_ROOT="$version"
pytest tests/simulators/webots/test_webots.py
pytest tests/simulators/webots
done
kill %1
'
stop_ec2_instance:
name: stop_ec2_instance
runs-on: ubuntu-latest
needs: [run_carla_simulators, run_webots_simulators]
steps:
needs: [start_ec2_instance, check_simulator_version_updates, check_nvidia_smi, run_carla_simulators, run_webots_simulators]
if: always()
env:
VOLUME_ID: ${{ needs.start_ec2_instance.outputs.volume_id }}
INSTANCE_ID: ${{ secrets.AWS_EC2_INSTANCE_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
steps:
- name: Stop EC2 Instance
env:
INSTANCE_ID: ${{ secrets.AWS_EC2_INSTANCE_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
run: |
# Get the instance state
# Get the instance state and stop it if running
instance_state=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq -r '.Reservations[].Instances[].State.Name')
# If the machine is pending wait for it to fully start
while [ "$instance_state" == "pending" ]; do
echo "Instance is pending startup, waiting for it to fully start..."
sleep 10
instance_state=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq -r '.Reservations[].Instances[].State.Name')
done
# Check if instance state is "stopped"
if [[ "$instance_state" == "running" ]]; then
echo "Instance is running, stopping it..."
aws ec2 stop-instances --instance-ids $INSTANCE_ID
elif [[ "$instance_state" == "stopping" ]]; then
echo "Instance is stopping..."
echo "Instance is running, stopping it..."
aws ec2 stop-instances --instance-ids $INSTANCE_ID
aws ec2 wait instance-stopped --instance-ids $INSTANCE_ID
echo "Instance has stopped."
elif [[ "$instance_state" == "stopped" ]]; then
echo "Instance is already stopped..."
exit 0
echo "Instance is already stopped."
else
echo "Unknown instance state: $instance_state"
exit 1
echo "Unexpected instance state: $instance_state"
exit 1
fi
- name: Detach Volume
run: |
# Detach the volume
aws ec2 detach-volume --volume-id $VOLUME_ID
aws ec2 wait volume-available --volume-ids $VOLUME_ID
echo "Volume $VOLUME_ID detached."
- name: Delete Volume
run: |
# Delete the volume after snapshot is complete
aws ec2 delete-volume --volume-id $VOLUME_ID
echo "Volume $VOLUME_ID deleted."
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,5 @@ dmypy.json

# generated parser
src/scenic/syntax/parser.py

simulation.gif
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Scenic
[<img src="https://docs.scenic-lang.org/en/latest/_static/logo-full.svg" alt="Scenic Logo" height="100">](https://scenic-lang.org/)

[![Documentation Status](https://readthedocs.org/projects/scenic-lang/badge/?version=latest)](https://scenic-lang.readthedocs.io/en/latest/?badge=latest)
[![Documentation Status](https://readthedocs.org/projects/scenic-lang/badge/?version=latest)](https://docs.scenic-lang.org/en/latest/?badge=latest)
[![Tests Status](https://github.com/BerkeleyLearnVerify/Scenic/actions/workflows/run-tests.yml/badge.svg)](https://github.com/BerkeleyLearnVerify/Scenic/actions/workflows/run-tests.yml)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

A compiler and scenario generator for Scenic, a domain-specific probabilistic programming language for modeling the environments of cyber-physical systems.
Please see the [documentation](https://scenic-lang.readthedocs.io/) for installation instructions, as well as tutorials and other information about the Scenic language, its implementation, and its interfaces to various simulators.
Please see the [documentation](https://docs.scenic-lang.org/) for installation instructions, as well as tutorials and other information about the Scenic language, its implementation, and its interfaces to various simulators.

For an overview of the language and some of its applications, see our [2022 journal paper](https://link.springer.com/article/10.1007/s10994-021-06120-5) on Scenic 2, which extends our [PLDI 2019 paper](https://arxiv.org/abs/1809.09310) on Scenic 1.
The new syntax and features of Scenic 3 are described in our [CAV 2023 paper](https://arxiv.org/abs/2307.03325).
Our [Publications](https://scenic-lang.readthedocs.io/en/latest/publications.html) page lists additional relevant publications.
Our [Publications](https://docs.scenic-lang.org/en/latest/publications.html) page lists additional relevant publications.

Scenic was initially designed and implemented by Daniel J. Fremont, Tommaso Dreossi, Shromona Ghosh, Xiangyu Yue, Alberto L. Sangiovanni-Vincentelli, and Sanjit A. Seshia.
Additionally, Edward Kim made major contributions to Scenic 2, and Eric Vin, Shun Kashiwa, Matthew Rhea, and Ellen Kalvan to Scenic 3.
Please see our [Credits](https://scenic-lang.readthedocs.io/en/latest/credits.html) page for details and more contributors.
Please see our [Credits](https://docs.scenic-lang.org/en/latest/credits.html) page for details and more contributors.

If you have any problems using Scenic, please submit an issue to [our GitHub repository](https://github.com/BerkeleyLearnVerify/Scenic).
If you have any problems using Scenic, please submit an issue to [our GitHub repository](https://github.com/BerkeleyLearnVerify/Scenic) or start a conversation on our [community forum](https://forum.scenic-lang.org/).

The repository is organized as follows:

Expand Down
49 changes: 28 additions & 21 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
codecov:
coverage:
precision: 2
round: down
range: "70...100"
status:
project:
default:
target: 80%
threshold: 1%
changes:
target: 80%
threshold: 1%
comment:
layout: "reach, diff, flags, files"
behavior: default
codecov:
require_ci_to_pass: true
ignore:
- "src/scenic/simulators/**"
- "tests/**"
- "!src/scenic/simulators/newtonian/**"
- "!src/scenic/simulators/utils/**"

coverage:
precision: 2
round: down
range: "70...100"
status:
project:
default:
target: 80%
threshold: 5%
patch:
default:
target: 80%
threshold: 5%
ignore:
- "tests/"
- "docs/"
- "src/scenic/simulators/airsim/"
- "src/scenic/simulators/carla/"
- "src/scenic/simulators/gta/"
- "src/scenic/simulators/lgsvl/"
- "src/scenic/simulators/webots/"
- "src/scenic/simulators/xplane/"
- "!**/*.py"
comment:
layout: "reach, diff, flags, files"
behavior: default
cli:
plugins:
pycoverage:
Expand Down
6 changes: 6 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ pre {tab-size: 4;}
.wy-table-responsive table td, .wy-table-responsive table th {white-space: normal;}
/* Increase maximum body width to support 100-character lines */
.wy-nav-content {max-width:900px;}
/* Make SVG logo render at the correct size */
.wy-side-nav-search .wy-dropdown > a img.logo, .wy-side-nav-search > a img.logo {
width: 100%;
}
/* Modify background color behind logo to make it more readable */
.wy-side-nav-search {background-color:#48ac92}
/* Shrink the sidebar to 270 pixels wide */
.wy-tray-container li, .wy-menu-vertical, .wy-side-nav-search, .wy-nav-side,
.rst-versions {width:270px;}
Expand Down
12 changes: 12 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
sphinx._buildingScenicDocs = True

from scenic.core.simulators import SimulatorInterfaceWarning
import scenic.syntax.compiler
from scenic.syntax.translator import CompileOptions
import scenic.syntax.veneer as veneer

Expand Down Expand Up @@ -151,6 +152,13 @@
"custom.css",
]

html_logo = "images/logo-full.svg"
html_favicon = "images/favicon.ico"

html_theme_options = {
"logo_only": True,
}

# -- Generate lists of keywords for the language reference -------------------

import itertools
Expand Down Expand Up @@ -178,6 +186,10 @@ def maketable(items, columns=5, gap=4):
with open("_build/keywords_soft.txt", "w") as outFile:
for row in maketable(ScenicParser.SOFT_KEYWORDS):
outFile.write(row + "\n")
with open("_build/builtin_names.txt", "w") as outFile:
for row in maketable(scenic.syntax.compiler.builtinNames):
outFile.write(row + "\n")


# -- Monkeypatch ModuleAnalyzer to handle Scenic modules ---------------------

Expand Down
1 change: 1 addition & 0 deletions docs/credits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Shun Kashiwa developed the auto-generated parser for Scenic 3.0 and its support

The Scenic tool and example scenarios have benefitted from additional code contributions from:

* Armando Bañuelos
* Johnathan Chiu
* Greg Crow
* Francis Indaheng
Expand Down
Binary file added docs/images/favicon.ico
Binary file not shown.
Loading

0 comments on commit 94c7983

Please sign in to comment.