Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: FudanSELab/train-ticket-auto-query
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: docc-lab/train-ticket-auto-query
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
Loading
Showing with 3,216 additions and 23 deletions.
  1. +41 −16 README.md
  2. +337 −0 prepare-bursty-service.sh
  3. +36 −0 prepare-victime-service.sh
  4. +110 −0 push-and-deploy.sh
  5. +22 −0 py-src/README.md
  6. 0 { → py-src}/__init__.py
  7. 0 { → py-src}/atomic_queries.py
  8. 0 { → py-src}/normal_request_manager.py
  9. +17 −5 { → py-src}/queries.py
  10. 0 { → py-src}/query_admin_basic_config.py
  11. 0 { → py-src}/query_admin_basic_price.py
  12. 0 { → py-src}/query_advanced_ticket.py
  13. 0 { → py-src}/query_and_cancel.py
  14. 0 { → py-src}/query_and_collect_ticket.py
  15. 0 { → py-src}/query_and_enter_station.py
  16. 0 { → py-src}/query_and_preserve.py
  17. 0 { → py-src}/query_and_put_consign.py
  18. 0 { → py-src}/query_and_rebook.py
  19. 0 { → py-src}/query_food.py
  20. 0 { → py-src}/query_order_and_pay.py
  21. 0 { → py-src}/query_route.py
  22. 0 { → py-src}/query_travel_left.py
  23. 0 { → py-src}/query_travel_left_parallel.py
  24. +20 −0 py-src/roy-test.py
  25. +2 −2 { → py-src}/scenarios.py
  26. 0 { → py-src}/utils.py
  27. +1 −0 randomize_configs.py
  28. +143 −0 redeploy-service.sh
  29. +78 −0 redeploy_service_old.sh
  30. +131 −0 tt-concurrent-load-generator/cache.go
  31. +18 −0 tt-concurrent-load-generator/date.go
  32. +5 −0 tt-concurrent-load-generator/go.mod
  33. +2 −0 tt-concurrent-load-generator/go.sum
  34. +13 −0 tt-concurrent-load-generator/logins.go
  35. +410 −0 tt-concurrent-load-generator/main.go
  36. +1,024 −0 tt-concurrent-load-generator/queries.go
  37. +329 −0 tt-concurrent-load-generator/scenarios.go
  38. +77 −0 tt-concurrent-load-generator/single-thrd/main-singlethrd.go
  39. +98 −0 tt-concurrent-load-generator/stats.go
  40. +85 −0 tt-concurrent-load-generator/utils.go
  41. +217 −0 tt-concurrent-load-generator/warmup.go
57 changes: 41 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,47 @@
# train-ticket-auto-query
# Concurrent Train-Ticket-Auto-Query Fork

Train Ticket Auto Query Python Scripts
This repo is a fork from [train-ticket's auto-query load generater](https://github.com/FudanSELab/train-ticket-auto-query). We implemented a concurrent version of it in golang under tt-coucurrent-load-generator dir (mainly because of horriable multi-threading in python). We also added a warmup mode for easily populating DB with orders in different states.

## How to use
## Usage

```python
import logging
from queries import Query
from scenarios import query_and_preserve
1. Find IP address of trainticket ui services

# login train-ticket and store the cookies
q = Query(url)
if not q.login():
logging.fatal('login failed')
```bash
kubectl get services | grep ts-ui-dashboard
```

# execute scenario on current user
query_and_preserve(q)
2. Populate the DB with warmup mode of concurrent load generator. Call it with `-warmup` flag to find the usage:
```bash
cd /local/train-ticket-auto-query/tt-concurrent-load-generator
./tt-concurrent-load-generator -warmup
```

# or execute query directly
q.query_high_speed_ticket()
```
3. Use concurrent load generator.
We have been updating the API and functionality of it, so directly call it for usage info.

```bash
cd /local/train-ticket-auto-query/tt-concurrent-load-generator
./tt-concurrent-load-generator
```


## Script for building and replacing pod image

We also provide script integrating the following steps of building & replacing pod image in trainticket k8s deployment. You may call the `prepare-victime-service.sh` to find usage. It contains several steps for our exp, you might need to remove unnecessary part or modify for your need.

Forget about the other script, though.

If you don't want to use above script, build new jars with `mvn clean install` under trainticket dir, and then build docker image and replace desired pod with new image:
```bash
# Build and push the Docker image
docker build -t "<your-image-registry>/<your-updated-service>:<your-image-tag>" .
docker push "<your-image-registry>/<your-updated-service>:<your-image-tag>"
# Update the Kubernetes deployment
kubectl set image "deployment/<your-updated-service>" "<your-updated-service>=<your-image-registry>/<your-updated-service>:<your-image-tag>"
# Wait for the rollout to complete
kubectl rollout status "deployment/<your-updated-service>"
```
Loading