Cytoscape Docker image, profiling

This commit is contained in:
Florian Förster 2024-09-04 18:02:12 +02:00
parent 9328c0218a
commit e85334ab06
7 changed files with 170 additions and 49 deletions

View File

@ -0,0 +1,37 @@
# based on official Cytoscape image: https://github.com/cytoscape/docker-cytoscape-desktop
# version more compact due to:
# - removed unnecessary packages and instructions --> remote display not used
# - included all environment variables within this Dockerfile, no need to use Docker compose for the build process
FROM ubuntu:22.04
# environment variables
ENV CYTOSCAPE_VERSION=3.10.2
ENV VIRTUAL_SCREEN_WIDTH=1920
ENV VIRTUAL_SCREEN_HEIGHT=1080
ENV CYREST_PORT=1234
ENV SUPERVISOR_CFG="/etc/supervisor/conf.d/supervisord.conf"
# labels
LABEL cytoscape_version="${CYTOSCAPE_VERSION}"
LABEL context="independent CyREST instance for graph rendering"
# change user
USER root
# install necessary packages
RUN apt update && apt full-upgrade -y && apt -y install \
libxcursor1 \
openjdk-17-jre \
supervisor \
wget \
xvfb
# set Java home directory as permanently set ENV var
RUN echo "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64" >> /root/.bashrc
# download and extract Cytoscape
RUN wget https://github.com/cytoscape/cytoscape/releases/download/${CYTOSCAPE_VERSION}/cytoscape-unix-${CYTOSCAPE_VERSION}.tar.gz
RUN tar -xf cytoscape-unix-${CYTOSCAPE_VERSION}.tar.gz && rm cytoscape-unix-${CYTOSCAPE_VERSION}.tar.gz
# supervisord config
# supervisor used to start the virtual display via Xvfb and the Cytoscape process with web server (CyREST)
COPY supervisord.conf ${SUPERVISOR_CFG}
EXPOSE ${CYREST_PORT}
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

View File

@ -0,0 +1,22 @@
# based on official Cytoscape image: https://github.com/cytoscape/docker-cytoscape-desktop
[supervisord]
nodaemon=true
[program:xvfb]
priority=1
directory=/
command=/usr/bin/Xvfb :1 -screen 0 "%(ENV_VIRTUAL_SCREEN_WIDTH)s"x"%(ENV_VIRTUAL_SCREEN_HEIGHT)s"x24 +extension RANDR
user=root
autostart=true
autorestart=true
stopsignal=QUIT
stdout_logfile=/var/log/xvfb.log
stderr_logfile=/var/log/xvfb.err
[program:cytoscape]
priority=30
command=/bin/bash -c 'rm -rf /root/CytoscapeConfiguration && /cytoscape-unix-%(ENV_CYTOSCAPE_VERSION)s/cytoscape.sh --rest %(ENV_CYREST_PORT)s'
user=root
autostart=true
stopsignal=QUIT
environment=DISPLAY=":1",HOME="/root"

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,8 @@
import cProfile
import pstats
import typing
from typing import cast
from pathlib import Path
from typing import Final, cast
from pandas import DataFrame
@ -38,6 +41,11 @@ from lang_main.types import (
TimelineCandidates,
)
# ** profiling
ONLY_PROFILING_REPORT: Final[bool] = True
USE_PROFILING: Final[bool] = True
PROFILE_REPORT_NAME: Final[str] = 'prof_report.profdata'
# ** build pipelines
pipe_target_feat = build_base_target_feature_pipe()
pipe_merge = build_merge_duplicates_pipe()
@ -168,4 +176,18 @@ def main() -> None:
if __name__ == '__main__':
main()
report_path = Path.cwd() / 'profiling'
if not report_path.exists():
report_path.mkdir(parents=True, exist_ok=True)
report_file = report_path / PROFILE_REPORT_NAME
if ONLY_PROFILING_REPORT:
p_stats = pstats.Stats(str(report_file))
p_stats.sort_stats(pstats.SortKey.CUMULATIVE).print_stats(60)
p_stats.sort_stats('tottime').print_stats(60)
elif USE_PROFILING:
cProfile.run('main()', str(report_file))
p_stats = pstats.Stats(str(report_file))
p_stats.sort_stats(pstats.SortKey.CUMULATIVE).print_stats(30)
p_stats.sort_stats('tottime').print_stats(30)
else:
main()

View File

@ -2,10 +2,10 @@
[paths]
inputs = './inputs/'
results = './results/dummy_N_1000/'
dataset = '../data/Dummy_Dataset_N_1000.csv'
# results = './results/test_20240807/'
# dataset = '../data/02_202307/Export4.csv'
# results = './results/dummy_N_1000/'
# dataset = '../data/Dummy_Dataset_N_1000.csv'
results = './results/test_20240807/'
dataset = '../data/02_202307/Export4.csv'
#results = './results/Export7/'
#dataset = './01_03_Rohdaten_202403/Export7_59499_Zeilen.csv'
#results = './results/Export7_trunc/'
@ -36,7 +36,7 @@ threshold_amount_characters = 5
threshold_similarity = 0.8
[graph_postprocessing]
threshold_edge_weight = 1
threshold_edge_weight = 150
[time_analysis.uniqueness]
threshold_unique_texts = 4

Binary file not shown.

Binary file not shown.