Skip to content

Commit 55bea0a

Browse files
committed
Update pages
1 parent 052eb5f commit 55bea0a

File tree

4 files changed

+141
-29
lines changed

4 files changed

+141
-29
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Deploy to GitHub Pages
33
on:
44
push:
55
branches:
6-
- main
6+
- pages
77
# Review gh actions docs if you want to further define triggers, paths, etc
88
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
99

@@ -51,5 +51,4 @@ jobs:
5151
steps:
5252
- name: Deploy to GitHub Pages
5353
id: deployment
54-
uses: actions/deploy-pages@v4
55-
54+
uses: actions/deploy-pages@v4

documentation/docs/setup/index.mdx

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import Tabs from '@theme/Tabs';
55
import TabItem from '@theme/TabItem';
66
import {os2} from '@site/src/helpers/os.ts';
77
import BrowserOnly from '@docusaurus/BrowserOnly';
8+
import Details from '@theme/Details';
9+
import CodeBlock from '@theme/CodeBlock';
810

911
# Setup
1012

@@ -20,14 +22,36 @@ The container also functions as a Remote Desktop Server (RDP) with preconfigured
2022

2123
## Build docker image
2224

23-
Change directory to the repository. Expected location is `.../ProbabilisticGraphQuery$`
25+
In this repository, the `devenv` folder contains scripts and source files to recreate the development and measurement environment.
26+
27+
<Details summary="Dockerfile for the environment">
28+
import Dockerfile from '!!../../src/helpers/partial-loader!!@site/../devenv/dockerfile';
29+
30+
<CodeBlock language="c">{Dockerfile}</CodeBlock>
31+
</Details>
32+
33+
34+
Before cuntinuing, ensure that the current working driectory is `devenv` od the repository. (`ProbabilisticGraphQuery/devenv`)
2435

2536
Build your own docker image with the following command:
26-
```
27-
docker build -t pgq-devenv devenv/dockerfile
28-
```
37+
38+
39+
<Tabs groupId="os">
40+
<TabItem value="win" label="Windows">
41+
import BuildWin from '!!../../src/helpers/partial-loader?lines=5-*!!@site/../devenv/build.bat';
42+
43+
<CodeBlock language="bash">{BuildWin}</CodeBlock>
44+
</TabItem>
45+
<TabItem value="linux" label="Posix">
46+
```bash
47+
docker build -t pgq-devenv dockerfile
48+
```
49+
</TabItem>
50+
</Tabs>
51+
2952
:::tip[Note]
30-
Downloading eclipse takes a lot of time. Be patient, or download the eclipse instance manually and replace `RUN wget 'https://www.eclipse.org/downloads ...` with `COPY <your file> eclipse.tar.gz`
53+
* Downloading eclipse takes a lot of time. Be patient, or download the eclipse instance manually and replace `RUN wget 'https://www.eclipse.org/downloads ...` with `COPY <your file> eclipse.tar.gz`
54+
* Building storm model checker can take up to an hour. It also takes significant memory to compile. To lower resource usage, adjust the `make -j12` flag in the dockerfile to use less CPU cores.
3155
:::
3256

3357
Alternatively, import the image using the following command:
@@ -39,52 +63,53 @@ docker image load -i <my image file>
3963
## Create container
4064

4165
Create container with the following command.
42-
<Tabs groupId="data">
43-
<TabItem value="posix" label="Linux">
66+
<Tabs groupId="os">
67+
<TabItem value="win" label="Windows">
68+
import InitWin from '!!../../src/helpers/partial-loader?lines=5-*!!@site/../devenv/init.bat';
69+
70+
<CodeBlock language="bash">{InitWin}</CodeBlock>
71+
</TabItem>
72+
<TabItem value="linux" label="Posix">
4473
```
4574
docker run -d -u root \
46-
--name=pgq-devenv \
75+
--name=pgq-devenv-storm \
4776
--security-opt seccomp=unconfined \
4877
-p 4100:3389 \
4978
--shm-size="1gb" \
5079
-v $(pwd):/config/ProbabilisticGraphQuery \
5180
pgq-devenv
5281
```
5382
</TabItem>
54-
<TabItem value="win" label="Windows">
55-
```
56-
docker run -d -u root ^
57-
--name=pgq-devenv ^
58-
--security-opt seccomp=unconfined ^
59-
-p 4100:3389 ^
60-
--shm-size="1gb" ^
61-
-v $(pwd):/config/ProbabilisticGraphQuery ^
62-
pgq-devenv
63-
```
64-
</TabItem>
83+
6584
</Tabs>
6685

6786
(Delayed) You can stop the container with:
6887
```
69-
docker container stop pgq-devenv
88+
docker container stop pgq-devenv-storm
7089
```
7190
(Delayed) You can restart the container with:
7291
```
73-
docker container start pgq-devenv
92+
docker container start pgq-devenv-storm
7493
```
7594
:::tip[Note]
7695
If you use `docker exec`, don't forget to set the user to `abc`.
7796
```
78-
docker exec -u abc -it -w /config pgq-devenv /bin/bash
97+
docker exec -u abc -it -w /config pgq-devenv-storm /bin/bash
7998
```
8099
:::
81100

82101
## Configuring container
83102

103+
### Download compile runtime dependencies
104+
105+
```
106+
docker exec -u abc -w /config/ProbabilisticGraphQuery/sources/hu.bme.mit.delta.api/libs/ pgq-devenv-storm ./download.sh
107+
docker exec -u abc -w /config/ProbabilisticGraphQuery/sources/hu.bme.mit.inf.measurement.utilities/libs/ pgq-devenv-storm ./download.sh
108+
```
109+
110+
### Configure editor
111+
84112
* Connect to the running container from an RDP client (address: `localhost:4100`, username: `abc`, password: `abc`)
85-
* Donload jar dependencies.
86-
* `/config/ProbabilisticGraphQuery/sources/hu.bme.mit.delta.api/libs/download.sh`
87-
* `/config/ProbabilisticGraphQuery/sources/hu.bme.mit.inf.measurement.utilities/libs/download.sh`
88113
* Launch Eclipse from `Applications -> Development -> Modeling 2024-03`
89114
* Pick a workplace. (Any directory works, but we recommend picking `/config/ProbabilisticGraphQuery/devenv/workplace`)
90115
* Import all projects from `/config/ProbabilisticGraphQuery/sources` (`File -> Import -> General -> Existing Projects into Workspace -> Next -> Select root directory -> /config/ProbabilisticGraphQuery/sources -> Projects -> Select All -> Finish`)

documentation/docusaurus.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const config: Config = {
4242
// Please change this to your repo.
4343
// Remove this to remove the "edit this page" links.
4444
editUrl:
45-
'https://github.com/PELAB-LiU/ProbabilisticGraphQuery/TODO/docs',
45+
'https://github.com/PELAB-LiU/ProbabilisticGraphQuery/blob/main/documentation',
4646
},
4747
blog: false,
4848
theme: {
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
const path = require('path');
2+
3+
/**
4+
* import Setup2 from '!!../src/util/partial-loader?start=^static\ void\ [*]setup_main_stack[(]&end=^[}]!!@site/../example_solutions/2025/userprog/process.c';
5+
*
6+
* @param {*} options
7+
* @returns
8+
*/
9+
function functionLoader(lines, options){
10+
var target = [];
11+
const start = new RegExp(options.start);
12+
const end = new RegExp(options.end);
13+
var idx = 0;
14+
while(idx<lines.length && !start.test(lines[idx])){
15+
idx++;
16+
}
17+
while(idx<lines.length && !end.test(lines[idx])){
18+
target.push(lines[idx]);
19+
idx++;
20+
}
21+
if(idx<lines.length){
22+
target.push(lines[idx]);
23+
}
24+
return target;
25+
}
26+
27+
function lineLoader(lines, options){
28+
var target = [];
29+
options.lines.split(',').forEach(interval => {
30+
if (interval.includes('-')) {
31+
const numeric_interval = interval.replace('*',lines.length)
32+
33+
// Parse start and end of the range
34+
const [start, end] = numeric_interval.split('-').map(num => parseInt(num.trim()));
35+
36+
if (isNaN(start) || isNaN(end) || start <=0 || end <= 0 || start > end || end > lines.length) {
37+
throw new Error(`Invalid range: "${interval}".`);
38+
}
39+
40+
// Collect elements within the range
41+
for (let i = start; i <= end; i++) {
42+
target.push(lines[i-1]);
43+
}
44+
} else {
45+
// Parse single index
46+
const index = parseInt(interval.trim())-1;
47+
if (isNaN(index)) {
48+
throw new Error(`Invalid index: "${interval}".`);
49+
}
50+
if (index >= 0 && index < lines.length) {
51+
target.push(lines[index]);
52+
}
53+
}
54+
});
55+
return target;
56+
}
57+
58+
/**
59+
* A function to select specific lines from a raw text file.
60+
* Specify: ?lines=(line|(start-end))[,(line|(start-end))]+
61+
* @param {*} source
62+
* @returns
63+
*/
64+
module.exports = function (source) {
65+
// Split the content into lines and trim the first 5 lines
66+
const contentLines = source.toString().split(/\r?\n/);
67+
// Retrieve the query parameter (interval of lines to trim)
68+
const options = this.getOptions() || {};
69+
70+
var target = [];
71+
72+
if(options.start && options.end){
73+
target = functionLoader(contentLines, options);
74+
} else if(options.lines){
75+
target = lineLoader(contentLines, options);
76+
} else {
77+
target = contentLines;
78+
}
79+
80+
// Join the remaining lines back together
81+
const trimmedContent = target.join('\n');
82+
83+
// Return the processed content
84+
return `module.exports = ${JSON.stringify(trimmedContent)}`;
85+
};
86+
87+
// Webpack needs to know that the loader is usable for text files
88+
module.exports.raw = true; // Indicates that the loader can accept raw file buffers*/

0 commit comments

Comments
 (0)