Commit 027e7b2e authored by Daniele Venzano's avatar Daniele Venzano

BOINC ZApp

parent 0ef32afa
Pipeline #4030 failed with stage
in 14 seconds
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
.idea/
state.zoe
/zoe*.conf
zoepass.csv
stages:
- deploy
variables:
VERSION: $CI_BUILD_ID
images:
image: docker:latest
stage: deploy
before_script:
- mkdir -p /etc/docker/certs.d/$DOCKER_REGISTRY
- cp /registry-ca.crt /etc/docker/certs.d/$DOCKER_REGISTRY/ca.crt
- mkdir -p $HOME/.docker
- echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
- apk update
- apk add python findutils bash
script:
- bash build_all.sh
- python gen_json.py
artifacts:
paths:
- "*.json"
only:
- master
FROM ubuntu:14.04
MAINTAINER Daniele Venzano <venza@brownhat.org>
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install --yes --no-install-recommends --no-install-suggests boinc && apt-get clean && rm -Rf /var/lib/apt/lists/*
RUN mkdir /data
WORKDIR /data
COPY files/cc_config.xml /data
CMD /usr/bin/boinc --abort_jobs_on_exit --exit_when_idle --fetch_minimal_work --attach_project ${PROJECT_URL} ${PROJECT_KEY}
<cc_config>
<log_flags>
<task>1</task>
<file_xfer>1</file_xfer>
<sched_ops>1</sched_ops>
<cpu_sched>1</cpu_sched>
</log_flags>
<options>
<ncpus>1</ncpus>
<report_results_immediately>1</report_results_immediately>
<no_priority_change>1</no_priority_change>
</options>
</cc_config>
# Copyright (c) 2016, Daniele Venzano
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Spark-Jupyter Zoe application description generator."""
import json
import sys
import os
APP_NAME = 'boinc'
ZOE_APPLICATION_DESCRIPTION_VERSION = 3
options = {
'project_url': {
'value': 'www.worldcommunitygrid.org',
'description': 'BOINC project URL'
},
'project_key': {
'value': 'Your key here',
'description': 'BOINC project key'
},
'memory_limit': {
'value': 512 * (1024**2),
'description': 'Memcached memory limit (bytes)'
},
'core_limit': {
'value': 1,
'description': 'Number of cores to allocate'
}
}
REGISTRY = os.getenv("DOCKER_REGISTRY", default="docker-engine:5000")
REPOSITORY = os.getenv("REPOSITORY", default="zapps")
VERSION = os.getenv("VERSION", default="latest")
IMAGE = REGISTRY + '/' + REPOSITORY + '/boinc:' + VERSION
def boinc_service(memory_limit, core_limit, project_key, project_url):
"""
:rtype: dict
"""
mem_limit_mb = memory_limit / (1024**2)
service = {
'name': "boinc-client",
'image': IMAGE,
'monitor': True,
'resources': {
"memory": {
"min": memory_limit,
"max": memory_limit
},
"cores": {
"min": core_limit,
"max": core_limit
}
},
'ports': [],
'environment': [
['PROJECT_URL', project_url],
['PROJECT_KEY', project_key]
],
'volumes': [],
'command': None,
'total_count': 1,
'essential_count': 1,
'startup_order': 0
}
return service
if __name__ == '__main__':
app = {
'name': APP_NAME,
'version': ZOE_APPLICATION_DESCRIPTION_VERSION,
'will_end': False,
'size': 512,
'services': [
boinc_service(options["memory_limit"]["value"], options["core_limit"]["value"], options["project_key"]["value"], options["project_url"]["value"])
]
}
json.dump(app, open("boinc.json", "w"), sort_keys=True, indent=4)
print("ZApp written")
logo.png

3.06 KB

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment