Skip to content

Commit c5828a7

Browse files
committed
Merge branch 'dev' into speed-shapefile-matching
2 parents ce711ee + 05aa44e commit c5828a7

File tree

84 files changed

+1595
-515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1595
-515
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This file was created by CodeQL for this repository. The only change was
2+
# removing 'python' and 'javascript' from the language array.
3+
#
4+
# For most projects, this workflow file will not need changing; you simply need
5+
# to commit it to your repository.
6+
#
7+
# You may wish to alter this file to override the set of languages analyzed,
8+
# or to provide custom queries or build logic.
9+
#
10+
# ******** NOTE ********
11+
# We have attempted to detect the languages in your repository. Please check
12+
# the `language` matrix defined below to confirm you have the correct set of
13+
# supported CodeQL languages.
14+
#
15+
name: "CodeQL"
16+
17+
on:
18+
push:
19+
branches: [ dev ]
20+
pull_request:
21+
# The branches below must be a subset of the branches above
22+
branches: [ dev ]
23+
schedule:
24+
- cron: '24 12 * * 1'
25+
26+
jobs:
27+
analyze:
28+
name: Analyze
29+
runs-on: ubuntu-latest
30+
permissions:
31+
actions: read
32+
contents: read
33+
security-events: write
34+
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
language: [ 'java' ]
39+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
40+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
41+
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v3
45+
46+
# Initializes the CodeQL tools for scanning.
47+
- name: Initialize CodeQL
48+
uses: github/codeql-action/init@v2
49+
with:
50+
languages: ${{ matrix.language }}
51+
# If you wish to specify custom queries, you can do so here or in a config file.
52+
# By default, queries listed here will override any specified in a config file.
53+
# Prefix the list here with "+" to use these queries and those in the config file.
54+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
55+
56+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57+
# If this step fails, then you should remove it and run the build manually (see below)
58+
- name: Autobuild
59+
uses: github/codeql-action/autobuild@v2
60+
61+
# ℹ️ Command-line programs to run using the OS shell.
62+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63+
64+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
65+
# and modify them (or add more) to build your code if your project
66+
# uses a compiled language
67+
68+
#- run: |
69+
# make bootstrap
70+
# make release
71+
72+
- name: Perform CodeQL Analysis
73+
uses: github/codeql-action/analyze@v2

.github/workflows/gradle.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,11 @@ jobs:
3333
fetch-depth: 0
3434
# Java setup step completes very fast, no need to run in a preconfigured docker container.
3535
- name: Set up JDK 11
36-
uses: actions/setup-java@v1
36+
uses: actions/setup-java@v3
3737
with:
3838
java-version: 11
39-
- uses: actions/cache@v1
40-
id: cache
41-
with:
42-
path: ~/.gradle/caches
43-
key: gradle-caches
39+
distribution: temurin
40+
cache: 'gradle'
4441
- name: Show version string
4542
run: gradle -q printVersion | head -n1
4643
- name: Build and Test

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ We refer to the routing method as "realistic" because it works by planning door-
77

88
We say "Real-world and Reimagined" networks because R5's networks are built from widely available open OSM and GTFS data describing baseline transportation systems, but R5 includes a system for applying light-weight patches to those networks for immediate, interactive scenario comparison.
99

10-
**Please note** that the Conveyal team does not provide technical support for third-party deployments of its analysis platform. We provide paid subscriptions to a cloud-based deployment of this system, which performs these complex calculations hundreds of times faster using a compute cluster. This project is open source primarily to ensure transparency and reproducibility in public planning and decision making processes, and in hopes that it may help researchers, students, and potential collaborators to understand and build upon our methodology.
10+
**Please note** that the Conveyal team does not provide technical support for third-party deployments. R5 is a component of a specialized commercial system, and we align development efforts with our roadmap and the needs of subscribers to our hosted service. This service is designed to facilitate secure online collaboration, user-friendly data management and scenario editing through a web interface, and complex calculations performed hundreds of times faster using a compute cluster. These design goals may not align well with other use cases. This project is open source primarily to ensure transparency and reproducibility in public planning and decision making processes, and in hopes that it may help researchers, students, and potential collaborators to understand and build upon our methodology.
11+
12+
While the Conveyal team provides ongoing support and compatibility to subscribers, third-party projects using R5 as a library may not work with future releases. R5 does not currently expose a stable programming interface ("API" or "SDK"). As we release new features, previous functions and data types may change. The practical effect is that third-party wrappers or language bindings (e.g., for R or Python) may need to continue using an older release of R5 for feature compatibility (though not necessarily result compatibility, as the methods used in R5 are now relatively mature).
1113

1214
## Methodology
1315

@@ -19,7 +21,7 @@ For details on the core methods implemented in Conveyal Analysis and R5, see:
1921

2022
### Citations
2123

22-
The Conveyal team is always eager to see cutting-edge uses of our software, so feel free to send us a copy of any thesis, report, or paper produced using this software. We also ask that any academic publications using this software cite the papers above, where relevant and appropriate.
24+
The Conveyal team is always eager to see cutting-edge uses of our software, so feel free to send us a copy of any thesis, report, or paper produced using this software. We also ask that any academic or research publications using this software cite the papers above, where relevant and appropriate.
2325

2426
## Configuration
2527

@@ -52,7 +54,7 @@ By default, IntelliJ will follow common Gradle practice and build R5 using the "
5254

5355
## Structured Commit Messages
5456

55-
We use structured commit messages to help generate changelogs and determine version numbers.
57+
We use structured commit messages to help generate changelogs.
5658

5759
The first line of these messages is in the following format: `<type>(<scope>): <summary>`
5860

@@ -68,10 +70,6 @@ The `(<scope>)` is optional and is often a class name. The `<summary>` should be
6870
- devops: Changes to code that only affect deployment, logging, etc. No changes to user code.
6971
- chore: Any other changes causing no changes to user code.
7072

71-
The body of the commit message (if any) should begin after one blank line. If the commit meets the definition of a major version change according to semantic versioning (e.g. a change in API visible to an external module), the commit message body should begin with `BREAKING CHANGE: <description>`.
72-
73-
Presence of a `fix` commit in a release should increment the number in the third (PATCH) position.
74-
Presence of a `feat` commit in a release should increment the number in the second (MINOR) position.
75-
Presence of a `BREAKING CHANGE` commit in a release should increment the number in the first (MAJOR) position.
73+
The body of the commit message (if any) should begin after one blank line.
7674

77-
This is based on https://www.conventionalcommits.org.
75+
From 2018 to 2020, we used major/minor/patch release numbering as suggested by https://www.conventionalcommits.org. Starting in 2021, we switched to major/minor release numbering, incrementing the minor version with regular feature releases and the major version only when there are substantial changes to the cluster computing components of our system. Because there is no public API at this time, the conventional definition of breaking changes under semantic versioning does not apply.

build.gradle

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
plugins {
22
id 'java'
3-
id 'com.github.johnrengelman.shadow' version '6.0.0'
3+
id 'com.github.johnrengelman.shadow' version '8.1.0'
44
id 'maven-publish'
5-
id 'com.palantir.git-version' version '0.12.3'
5+
id 'com.palantir.git-version' version '2.0.0'
66
}
77

88
group = 'com.conveyal'
@@ -72,17 +72,19 @@ tasks.withType(JavaCompile) {
7272
options.encoding = 'UTF-8'
7373
}
7474

75-
// A task to copy all dependencies of the project into a single directory
75+
// A task to copy all dependency JARs needed at runtime into a single directory
7676
task copyDependencies(type: Copy) {
77-
from configurations.default
77+
from(sourceSets.main.runtimeClasspath) {
78+
include '*.jar'
79+
}
7880
into 'dependencies'
7981
}
8082

8183
// Run R5 as a local analysis backend with all dependencies on the classpath, without building a shadowJar.
8284
task runBackend (type: JavaExec) {
8385
dependsOn(build)
8486
classpath(sourceSets.main.runtimeClasspath)
85-
main("com.conveyal.analysis.BackendMain")
87+
mainClass = 'com.conveyal.analysis.BackendMain'
8688
}
8789

8890
// Start up an analysis local backend from a shaded JAR and ask it to shut down immediately.
@@ -91,7 +93,7 @@ task runBackend (type: JavaExec) {
9193
task testShadowJarRunnable(type: JavaExec) {
9294
dependsOn(shadowJar)
9395
classpath(shadowJar.archiveFile.get())
94-
main("com.conveyal.analysis.BackendMain")
96+
mainClass = 'com.conveyal.analysis.BackendMain'
9597
jvmArgs("-Dconveyal.immediate.shutdown=true")
9698
}
9799

@@ -123,12 +125,8 @@ repositories {
123125
// Put Open Source Geospatial before Maven Central to get JAI core, see https://stackoverflow.com/a/26993223
124126
maven { url 'https://repo.osgeo.org/repository/release/' }
125127
mavenCentral()
126-
// TODO review whether we really need these repositories
128+
// Polyline encoder 0.2 is now in Maven repo
127129
maven { url 'https://maven.conveyal.com' }
128-
// Used for importing java projects from github (why do we need this?)
129-
maven { url 'https://jitpack.io' }
130-
// For the polyline encoder
131-
maven { url 'https://nexus.axiomalaska.com/nexus/content/repositories/public-releases' }
132130
}
133131

134132
// Exclude all JUnit 4 transitive dependencies - IntelliJ bug causes it to think we're using Junit 4 instead of 5.

src/main/java/com/conveyal/analysis/components/TaskScheduler.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,39 @@ public final void run () {
168168
List<ApiTask> apiTaskList = tasks.stream()
169169
.map(Task::toApiTask)
170170
.collect(Collectors.toUnmodifiableList());
171-
tasks.removeIf(t -> t.durationComplete().getSeconds() > 60);
171+
// Purge old tasks.
172+
tasks.removeIf(t -> t.durationComplete().toDays() > 3);
172173
return apiTaskList;
173174
}
174175
}
175176

177+
/**
178+
* Return a single task. Does not purge old tasks.
179+
*/
180+
public Task getTaskForUser (String userEmail, String taskId) {
181+
synchronized (tasksForUser) {
182+
Set<Task> tasks = tasksForUser.get(userEmail);
183+
if (tasks == null) return null;
184+
for (Task t : tasks) {
185+
if (t.id.toString().equals(taskId)) {
186+
return t;
187+
}
188+
}
189+
return null;
190+
}
191+
}
192+
193+
/**
194+
* Remove a task. Returns false if task does not exist. Returns true if task exists and is properly removed.
195+
*/
196+
public boolean removeTaskForUser (String userEmail, String taskId) {
197+
synchronized (tasksForUser) {
198+
Set<Task> tasks = tasksForUser.get(userEmail);
199+
if (tasks == null) return false;
200+
return tasks.removeIf(t -> t.id.toString().equals(taskId));
201+
}
202+
}
203+
176204
// Q: Should the caller ever create its own Tasks, or if are tasks created here inside the TaskScheduler from
177205
// other raw information? Having the caller creating a Task seems like a good way to configure execution details
178206
// like heavy/light/periodic, and submit user information without passing it in. That task request could be separate

0 commit comments

Comments
 (0)