Add frontend as submodule; Update README.md

This commit is contained in:
Lou Knauer 2021-10-26 10:26:39 +02:00
parent 61cdcf4ead
commit c61a5a8e77
6 changed files with 58 additions and 44 deletions

17
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Build & Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Checkout code
uses: actions/checkout@v2
- name: Build, Vet & Test
run: |
go build ./...
go vet ./...
go test -v ./...

8
.gitignore vendored
View File

@ -1,4 +1,6 @@
job.db
job-data
# executable:
cc-jobarchive
clusters
/var/job-archive
/var/*.db

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "frontend"]
path = frontend
url = git@github.com:ClusterCockpit/cc-svelte-datatable.git

View File

@ -1,49 +1,39 @@
# Run server
# ClusterCockpit with a Golang backend (Only supports archived jobs)
* The server expects the SQLite Job database in `./job.db`.
* The metric data as JSON is expected in `./job-data/<clusterId>/.../data.json`.
* A JSON-description of the clusters is expected in `./job-data/<clusterId>/cluster.json`.
* Run `go run server.go`
* The GraphQL backend is located at http://localhost:8080/query .
[![Build](https://github.com/ClusterCockpit/cc-metric-store/actions/workflows/test.yml/badge.svg)](https://github.com/ClusterCockpit/cc-metric-store/actions/workflows/test.yml)
# Debugging and Testing
### Run server
There is a GraphQL PLayground for testing queries at http://localhost:8080/ .
```sh
# The frontend is a submodule, so use `--recursive`
git clone --recursive git@github.com:ClusterCockpit/cc-jobarchive.git
Example Query:
```
query($filter: JobFilterList!, $sorting: OrderByInput!, $paging: PageRequest!) {
jobs(
filter: $filter
order: $sorting
page: $paging
) {
count
items {
id
jobId
userId
startTime
duration
}
}
}
# Prepare frontend
cd ./cc-jobarchive/frontend
yarn install
yarn build
cd ..
go get
go build
# The job-archive directory must be organised the same way as
# as for the regular ClusterCockpit.
ln -s <your-existing-job-archive> ./var/job-archive
# Create empty job.db (Will be initialized as SQLite3 database)
touch ./var/job.db
# This will first initialize the job.db database by traversing all
# `meta.json` files in the job-archive. After that, a HTTP server on
# the port 8080 will be running. The `--init-db` is only needed the first time.
./cc-jobarchive --init-db
# Show other options:
./cc-jobarchive --help
```
Using the Query variables:
```
{
"filter": { "list": [
{"userId": {"contains": "unrz"}},
{"duration": {"from": 60, "to": 1000}},
{"startTime": {"from": "2019-06-01T00:00:00.00Z", "to": "2019-10-01T00:00:00.00Z"}}]},
"sorting": { "field": "start_time", "order": "ASC" },
"paging": { "itemsPerPage": 20, "page": 1 }
}
```
### Update GraphQL schema
# Changing the GraphQL schema
This project uses [gqlgen](https://github.com/99designs/gqlgen) for the GraphQL API. The schema can be found in `./graph/schema.graphqls`. After changing it, you need to run `go run github.com/99designs/gqlgen` which will update `graph/model`. In case new resolvers are needed, they will be inserted into `graph/schema.resolvers.go`, where you will need to implement them.
* Edit ```./graph/schema.graphqls```
* Regenerate code: ```gqlgen generate```
* Implement callbacks in ```graph/resolvers.go```

1
frontend Submodule

@ -0,0 +1 @@
Subproject commit b487af3496b46942d9848337bc2821575a1390b2

1
var/ui.config.json Normal file
View File

@ -0,0 +1 @@
{"analysis_view_histogramMetrics":["flops_any","mem_bw","mem_used"],"analysis_view_scatterPlotMetrics":[["flops_any","mem_bw"],["flops_any","cpu_load"],["cpu_load","mem_bw"]],"job_view_nodestats_selectedMetrics":["flops_any","mem_bw","mem_used"],"job_view_polarPlotMetrics":["flops_any","mem_bw","mem_used","net_bw","file_bw"],"job_view_selectedMetrics":["flops_any","mem_bw","mem_used"],"plot_general_colorBackground":true,"plot_general_colorscheme":["#00bfff","#0000ff","#ff00ff","#ff0000","#ff8000","#ffff00","#80ff00"],"plot_general_lineWidth":1,"plot_list_jobsPerPage":10,"plot_list_selectedMetrics":["cpu_load","mem_used","flops_any","mem_bw","clock"],"plot_view_plotsPerRow":4,"plot_view_showPolarplot":true,"plot_view_showRoofline":true,"plot_view_showStatTable":true}