Skip to content

Commit aeef827

Browse files
committed
Most functions of qconf
1 parent 92f192e commit aeef827

21 files changed

+5012
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ go.work.sum
2323

2424
# env file
2525
.env
26+
27+
.DS_Store
28+
pkg/qconf/.coverage.html
29+
30+
installation/

Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#___INFO__MARK_BEGIN_NEW__
2+
###########################################################################
3+
#
4+
# Copyright 2024 HPC-Gridware GmbH
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
###########################################################################
19+
#___INFO__MARK_END_NEW__
20+
21+
FROM hpcgridware/clusterscheduler-latest-ubuntu2204:latest
22+
23+
RUN mkdir -p /opt/helpers
24+
25+
COPY autoinstall.template /opt/helpers/
26+
COPY installer.sh /opt/helpers/
27+
COPY entrypoint.sh /entrypoint.sh
28+
29+
ARG GOLANG_VERSION=1.22.4
30+
31+
RUN apt-get update && \
32+
apt-get install -y wget git gcc make vim libhwloc-dev hwloc
33+
34+
RUN wget https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz && \
35+
rm -rf /usr/local/go && \
36+
tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz && \
37+
rm go${GOLANG_VERSION}.linux-amd64.tar.gz
38+
39+
ENV PATH=$PATH:/usr/local/go/bin:/root/go/bin
40+
41+
RUN mkdir -p /root/go/bin && \
42+
mkdir -p /root/go/src/github.com/dgruber
43+
44+
RUN cd /root/go/src/github.com/dgruber && \
45+
git clone https://github.com/dgruber/drmaa.git
46+
47+
RUN go install github.com/onsi/ginkgo/v2/ginkgo@latest
48+
49+
WORKDIR /root/go/src/github.com/dgruber
50+
51+
ENV SGE_ROOT=/opt/cs-install
52+
ENV LD_LIBRARY_PATH ${SGE_ROOT}/lib/lx-amd64
53+
54+
ENTRYPOINT [ "/entrypoint.sh" ]

Makefile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#___INFO__MARK_BEGIN_NEW__
2+
###########################################################################
3+
#
4+
# Copyright 2024 HPC-Gridware GmbH
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
###########################################################################
19+
#___INFO__MARK_END_NEW__
20+
21+
# This Makefile is used for development and testing purposes only.
22+
23+
IMAGE_NAME = $(shell basename $(CURDIR))
24+
IMAGE_TAG = latest
25+
CONTAINER_NAME = $(IMAGE_NAME)
26+
27+
.PHONY: build
28+
build:
29+
@echo "Building the Open Cluster Scheduler image..."
30+
docker build -t $(IMAGE_NAME):$(IMAGE_TAG) .
31+
32+
.PHONY: run
33+
run: build
34+
@echo "Running the container..."
35+
mkdir -p ./installation
36+
docker run --rm -it -h master --name $(CONTAINER_NAME) -v ./installation:/opt/cs-install -v ./:/root/go/src/github.com/hpc-gridware/go-clusterscheduler $(IMAGE_NAME):$(IMAGE_TAG) /bin/bash
37+
38+
.PHONY: clean
39+
clean:
40+
@echo "Removing the container..."
41+
docker rm -f $(CONTAINER_NAME) || true
42+
@echo "Removing the image..."
43+
docker rmi $(IMAGE_NAME):$(IMAGE_TAG) || true
44+
@echo "Removing the installation directory..."
45+
rm -rf ./installation

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Open Cluster Scheduler Go API
2+
3+
Welcome to the **Open Cluster Scheduler Go API** repository. This project provides
4+
a Go-based API to interact with the Open Cluster Scheduler, encapsulating the
5+
command-line interface to streamline the development and management of cluster
6+
scheduling applications.
7+
8+
## Features
9+
10+
The Go API offers a range of powerful features, including:
11+
12+
- **`qconf` Command Line Wrapper**: This primary feature enables
13+
developers to build robust applications to configure the Open/Gridware
14+
Cluster Scheduler effortlessly.
15+
16+
## Go API Development Container
17+
18+
This project includes scripts to set up a one-node Open Cluster Scheduler
19+
cluster, which helps you to quickly build and test Go API applications
20+
without manually constructing a build environment.
21+
22+
## Getting Started
23+
24+
### Prerequisites
25+
26+
To begin, ensure you have the following software installed:
27+
28+
- Docker
29+
- `make` tool
30+
31+
### Building and Testing Using the Container
32+
33+
#### Build the Container
34+
35+
First, build the container, which is based on Ubuntu 22.04
36+
and includes all required dependencies:
37+
38+
```bash
39+
make build
40+
```
41+
42+
#### Run the Single Node Cluster
43+
44+
After successfully building the container, you can initialize and
45+
run a single-node cluster:
46+
47+
```bash
48+
make run
49+
```
50+
51+
Upon the first successful execution of `make run`, you can expect
52+
command line output similar to the following:
53+
54+
```shell
55+
Install log can be found in: /opt/cs-install/default/common/install_logs/qmaster_install_master_2024-08-11_12:00:00.log
56+
Install log can be found in: /opt/cs-install/default/common/install_logs/execd_install_master_2024-08-11_12:00:00.log
57+
root@master modified "global" in configuration list
58+
root@master modified "all.q" in cluster queue list
59+
```
60+
61+
This indicates that the cluster has been successfully set up. You can
62+
check the status of the cluster by running the following command:
63+
64+
```bash
65+
> qhost
66+
HOSTNAME ARCH NCPU NSOC NCOR NTHR LOAD MEMTOT MEMUSE SWAPTO SWAPUS
67+
----------------------------------------------------------------------------------------------
68+
global - - - - - - - - - -
69+
master lx-amd64 7 1 7 7 0.37 23.5G 838.0M 3.0G 0.0
70+
> cd /root/go/src/github.com/hpc-gridware/go-clusterscheduler/pkg/qconf
71+
> ginkgo -v
72+
...
73+
```
74+
75+
The installation directly is the local "installation" subdirectory on the
76+
the host which is mounted into the container. The subsequent runs of `make run`
77+
will reuse the existing installation for faster startup. If you want to
78+
reinstall the cluster, you can remove the `installation` directory and
79+
run `make run` again.
80+
81+
## Issues
82+
83+
If you encounter any issues or have questions, please open an issue in
84+
this repository. We'll be happy to assist.

autoinstall.template

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
SGE_ROOT="/opt/cs-install"
2+
SGE_QMASTER_PORT="6444"
3+
SGE_EXECD_PORT="6445"
4+
SGE_ENABLE_SMF="false"
5+
SGE_CLUSTER_NAME="p6444"
6+
CELL_NAME="default"
7+
ADMIN_USER="root"
8+
QMASTER_SPOOL_DIR="/opt/cs-install/default/spool/master"
9+
EXECD_SPOOL_DIR="/opt/cs-install/default/spool/execd"
10+
GID_RANGE="20000-20100"
11+
SPOOLING_METHOD="classic"
12+
DB_SPOOLING_DIR="/opt/cs-install/default/spool/bdb"
13+
#PG_SPOOLING_ARGS="none"
14+
PAR_EXECD_INST_COUNT="20"
15+
ADMIN_HOST_LIST="docker"
16+
SUBMIT_HOST_LIST="docker"
17+
EXEC_HOST_LIST="docker"
18+
EXECD_SPOOL_DIR_LOCAL=""
19+
HOSTNAME_RESOLVING="true"
20+
SHELL_NAME="ssh"
21+
COPY_COMMAND="scp"
22+
DEFAULT_DOMAIN="none"
23+
ADMIN_MAIL="none"
24+
ADD_TO_RC="true"
25+
SET_FILE_PERMS="true"
26+
RESCHEDULE_JOBS="wait"
27+
SCHEDD_CONF="3"
28+
SHADOW_HOST=""
29+
EXEC_HOST_LIST_RM=""
30+
REMOVE_RC="false"
31+
CSP_RECREATE="true"
32+
CSP_COPY_CERTS="false"
33+
CSP_COUNTRY_CODE="DE"
34+
CSP_STATE="Germany"
35+
CSP_LOCATION="Building"
36+
CSP_ORGA="Organisation"
37+
CSP_ORGA_UNIT="Organisation_unit"
38+
CSP_MAIL_ADDRESS="[email protected]"
39+
#SGE_READER_THREADS="2"

cmd/diag/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
diag

cmd/diag/diag.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
7+
"github.com/hpc-gridware/go-clusterscheduler/pkg/qconf"
8+
)
9+
10+
func main() {
11+
qc, _ := qconf.NewCommandLineQConf("qconf")
12+
cc, err := qc.ReadClusterConfiguration()
13+
if err != nil {
14+
fmt.Println(err)
15+
return
16+
}
17+
prettyPrint(cc)
18+
}
19+
20+
func prettyPrint(v interface{}) {
21+
js, err := json.MarshalIndent(v, "", " ")
22+
if err != nil {
23+
panic(err)
24+
}
25+
fmt.Println(string(js))
26+
}

cmd/diag/go.mod

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module github.com/hpc-gridware/go-clusterscheduler/cmd/diag
2+
3+
go 1.22.4
4+
5+
replace github.com/hpc-gridware/go-clusterscheduler => ./../../../go-clusterscheduler
6+
7+
require github.com/hpc-gridware/go-clusterscheduler v0.0.0-00010101000000-000000000000

entrypoint.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
#___INFO__MARK_BEGIN_NEW__
4+
###########################################################################
5+
#
6+
# Copyright 2024 HPC-Gridware GmbH
7+
#
8+
# Licensed under the Apache License, Version 2.0 (the "License");
9+
# you may not use this file except in compliance with the License.
10+
# You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an "AS IS" BASIS,
16+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
#
20+
###########################################################################
21+
#___INFO__MARK_END_NEW__
22+
23+
# Start or install Open Cluster Scheduler
24+
cd /opt/helpers
25+
./installer.sh
26+
27+
source /opt/cs-install/default/common/settings.sh
28+
29+
cd /root/go/src/github.com/hpc-gridware/go-clusterscheduler
30+
31+
exec "$@"

go.mod

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module github.com/hpc-gridware/go-clusterscheduler
2+
3+
go 1.22.4
4+
5+
require (
6+
github.com/onsi/ginkgo/v2 v2.19.1
7+
github.com/onsi/gomega v1.34.1
8+
)
9+
10+
require (
11+
github.com/go-logr/logr v1.4.2 // indirect
12+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
13+
github.com/google/go-cmp v0.6.0 // indirect
14+
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
15+
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
16+
golang.org/x/net v0.27.0 // indirect
17+
golang.org/x/sys v0.22.0 // indirect
18+
golang.org/x/text v0.16.0 // indirect
19+
golang.org/x/tools v0.23.0 // indirect
20+
gopkg.in/yaml.v3 v3.0.1 // indirect
21+
)

go.sum

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
4+
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
5+
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
6+
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
7+
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
8+
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
9+
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg=
10+
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
11+
github.com/onsi/ginkgo/v2 v2.19.1 h1:QXgq3Z8Crl5EL1WBAC98A5sEBHARrAJNzAmMxzLcRF0=
12+
github.com/onsi/ginkgo/v2 v2.19.1/go.mod h1:O3DtEWQkPa/F7fBMgmZQKKsluAy8pd3rEQdrjkPb9zA=
13+
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
14+
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
15+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
16+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
17+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
18+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
19+
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
20+
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
21+
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
22+
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
23+
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
24+
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
25+
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
26+
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
27+
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
28+
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
29+
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
30+
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
31+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
32+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
33+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
34+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)