Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 127-eliminate-more-references-to-hive_posts_view
  • 221-vacuum-hivemind-tables
  • 267-rebased-onto-develop
  • 267-update-notification-cache-3
  • 676-as-tiny-assets
  • 72-postgres-warning-about-wrong-collation-in-recursive_deps-2
  • abw_ecv_op_experiment
  • abw_max_retries
  • abw_post_delete_fix
  • abw_rshares_experiment
  • add-git-to-requirements
  • add-vote-info
  • arc-get-content-deleted
  • as-tmp-to-remove
  • asuch-limit-follows
  • asuch-postgrest-fixing-problems
  • asuch-replace-python-with-sql-get-follow-count
  • asuch-tmp-wip-condenser-get-blog
  • autoexplain-python
  • bridge_api.get_ranked_posts_fixes
  • bw_1_27_5rc8_2master
  • bw_develop-haf-rebase
  • bw_docker_supplement
  • bw_entrypoint_signal_handler_fix
  • bw_haf_compat_sync
  • bw_hafah_datasource_test
  • bw_master2develop
  • bw_mi/hivemind_wit_sa_btracker_rebase
  • bw_rebased_develop-haf
  • bw_restore_log_memory_usage_call
  • bw_simplify_blacklisted_by_observer_view
  • bw_temp_hived_source_node_verification
  • bw_update_posts_rshares_speedup
  • bw_v1_27_5_0_0_rc0
  • change-python-limits
  • cherry-pick-5dd1da34
  • cherry-pick-98eaf112
  • complete-refactor
  • db-upgrade-assert
  • deployed_20200917
  • deployed_20200928
  • deployed_20200928_pure
  • deployed_20200928_reversible_ops
  • deployed_fixes_2_develop
  • develop
  • develop-haf-backup
  • dk-benchmarks-ci-improvements
  • dk-communities-unit-tests
  • dk-get-ids-for-accounts-hotfix
  • dk-issue-3-concurrent-block-query
  • dk-list-votes-pre24
  • dk-migration-script-tags-support
  • dk-num-block-hive-feed-cache
  • dk-readme-update
  • dk-reputation_api_support
  • dk-revert-black-lists
  • dk-sql-file-list
  • dk-sql-script-executor
  • dk-sql-scripts-from-schema
  • dk-xdist-and-time
  • dn-autovacuum
  • dn-default-autovacuum
  • dn-testing
  • dn_get_block_range
  • dn_parallel_safe
  • dn_prof
  • doc-fix
  • dockerfile-update-fix
  • emf-limit-follows
  • enum_block_operations-support
  • feature/beneficiaries_communities
  • feature/hive_votes_no_index
  • feature/mute-reason-test
  • feature/mute-reason_rebase
  • feature/new_communities_type_old
  • feature/new_community_types
  • feature/role-only-if-subscribed-test1
  • fix-duplicate-pinned-posts
  • fixing-tests-with-limits
  • follow-deltas
  • follow-redesign
  • follow-redesign-speedups
  • follow-redesign-tests
  • follow_api_tests
  • get-discussion-experiment
  • hivemind_testers
  • imwatsi-first-steps
  • jes2850-decentralized-lists
  • jsalyers-add-a-cascade
  • jsalyers-fix-muting-for-reblogs
  • jsalyers-fix-muting-on-bridge-get-discussion
  • jsalyers-muting-v2
  • jsalyers-test-mute-changes
  • kbotor/backup/building-hivemind-from-other-repos
  • kbotor/building-hivemind-from-other-repos
  • kbotor/ci-rewrite-for-parallel-replay
  • km_ah_api
  • km_get_content_2_0
  • km_get_content_fill_missing2deployed
  • km_history
  • 0.25.4
  • 1.25.0rc0
  • 1.25.2rc
  • 1.26.0
  • 1.26.1
  • 1.26.2
  • 1.26.3
  • 1.27.0.dev0
  • 1.27.10
  • 1.27.11rc1
  • 1.27.11rc2
  • 1.27.11rc3
  • 1.27.11rc4
  • 1.27.11rc5
  • 1.27.3.0.0
  • 1.27.3.0.0dev11
  • 1.27.3.0.0dev12
  • 1.27.3.0.0dev7
  • 1.27.5
  • 1.27.5.0.0rc7
  • 1.27.5rc8
  • 1.27.5rc9
  • 1.27.6rc3
  • 1.27.6rc5
  • 1.27.6rc6
  • 1.27.6rc7
  • 1.27.6rc8
  • 1.27.6rc9
  • 1.27.7rc10
  • 1.27.7rc11
  • 1.27.7rc12
  • 1.27.7rc13
  • 1.27.7rc14
  • 1.27.7rc15
  • 1.27.7rc16
  • 1.27.8
  • 1.27.9
  • Before-dk-issue-3
  • Full-sync
  • Full-sync-20200928
  • Full-sync-20201026
  • ScheduledBenchmarkTesting_18_Aug
  • env/staging-permissions
  • full_hive_sync_17_05_2021
  • git_versioning_support
  • hivemind_ci_support
  • tmp-logs
  • v1.24-RC
  • v1.24.0
  • v1.24.1
  • v1.24.1-RC
  • v1.24.2
  • v1.25.1
  • v1.25.2
  • v1.25.3
  • v1.25.4
  • v1.26.0
  • v1.27.4.0.0
  • v1.27.4.0.0dev1
  • v1.27.4.0.0dev2
160 results

Target

Select target project
  • hive/hivemind
1 result
Select Git revision
  • 127-eliminate-more-references-to-hive_posts_view
  • 221-vacuum-hivemind-tables
  • 267-rebased-onto-develop
  • 267-update-notification-cache-3
  • 676-as-tiny-assets
  • 72-postgres-warning-about-wrong-collation-in-recursive_deps-2
  • abw_ecv_op_experiment
  • abw_max_retries
  • abw_post_delete_fix
  • abw_rshares_experiment
  • add-git-to-requirements
  • add-vote-info
  • arc-get-content-deleted
  • as-tmp-to-remove
  • asuch-limit-follows
  • asuch-postgrest-fixing-problems
  • asuch-replace-python-with-sql-get-follow-count
  • asuch-tmp-wip-condenser-get-blog
  • autoexplain-python
  • bridge_api.get_ranked_posts_fixes
  • bw_1_27_5rc8_2master
  • bw_develop-haf-rebase
  • bw_docker_supplement
  • bw_entrypoint_signal_handler_fix
  • bw_haf_compat_sync
  • bw_hafah_datasource_test
  • bw_master2develop
  • bw_mi/hivemind_wit_sa_btracker_rebase
  • bw_rebased_develop-haf
  • bw_restore_log_memory_usage_call
  • bw_simplify_blacklisted_by_observer_view
  • bw_temp_hived_source_node_verification
  • bw_update_posts_rshares_speedup
  • bw_v1_27_5_0_0_rc0
  • change-python-limits
  • cherry-pick-5dd1da34
  • cherry-pick-98eaf112
  • complete-refactor
  • db-upgrade-assert
  • deployed_20200917
  • deployed_20200928
  • deployed_20200928_pure
  • deployed_20200928_reversible_ops
  • deployed_fixes_2_develop
  • develop
  • develop-haf-backup
  • dk-benchmarks-ci-improvements
  • dk-communities-unit-tests
  • dk-get-ids-for-accounts-hotfix
  • dk-issue-3-concurrent-block-query
  • dk-list-votes-pre24
  • dk-migration-script-tags-support
  • dk-num-block-hive-feed-cache
  • dk-readme-update
  • dk-reputation_api_support
  • dk-revert-black-lists
  • dk-sql-file-list
  • dk-sql-script-executor
  • dk-sql-scripts-from-schema
  • dk-xdist-and-time
  • dn-autovacuum
  • dn-default-autovacuum
  • dn-testing
  • dn_get_block_range
  • dn_parallel_safe
  • dn_prof
  • doc-fix
  • dockerfile-update-fix
  • emf-limit-follows
  • enum_block_operations-support
  • feature/beneficiaries_communities
  • feature/hive_votes_no_index
  • feature/mute-reason-test
  • feature/mute-reason_rebase
  • feature/new_communities_type_old
  • feature/new_community_types
  • feature/role-only-if-subscribed-test1
  • fix-duplicate-pinned-posts
  • fixing-tests-with-limits
  • follow-deltas
  • follow-redesign
  • follow-redesign-speedups
  • follow-redesign-tests
  • follow_api_tests
  • get-discussion-experiment
  • hivemind_testers
  • imwatsi-first-steps
  • jes2850-decentralized-lists
  • jsalyers-add-a-cascade
  • jsalyers-fix-muting-for-reblogs
  • jsalyers-fix-muting-on-bridge-get-discussion
  • jsalyers-muting-v2
  • jsalyers-test-mute-changes
  • kbotor/backup/building-hivemind-from-other-repos
  • kbotor/building-hivemind-from-other-repos
  • kbotor/ci-rewrite-for-parallel-replay
  • km_ah_api
  • km_get_content_2_0
  • km_get_content_fill_missing2deployed
  • km_history
  • 0.25.4
  • 1.25.0rc0
  • 1.25.2rc
  • 1.26.0
  • 1.26.1
  • 1.26.2
  • 1.26.3
  • 1.27.0.dev0
  • 1.27.10
  • 1.27.11rc1
  • 1.27.11rc2
  • 1.27.11rc3
  • 1.27.11rc4
  • 1.27.11rc5
  • 1.27.3.0.0
  • 1.27.3.0.0dev11
  • 1.27.3.0.0dev12
  • 1.27.3.0.0dev7
  • 1.27.5
  • 1.27.5.0.0rc7
  • 1.27.5rc8
  • 1.27.5rc9
  • 1.27.6rc3
  • 1.27.6rc5
  • 1.27.6rc6
  • 1.27.6rc7
  • 1.27.6rc8
  • 1.27.6rc9
  • 1.27.7rc10
  • 1.27.7rc11
  • 1.27.7rc12
  • 1.27.7rc13
  • 1.27.7rc14
  • 1.27.7rc15
  • 1.27.7rc16
  • 1.27.8
  • 1.27.9
  • Before-dk-issue-3
  • Full-sync
  • Full-sync-20200928
  • Full-sync-20201026
  • ScheduledBenchmarkTesting_18_Aug
  • env/staging-permissions
  • full_hive_sync_17_05_2021
  • git_versioning_support
  • hivemind_ci_support
  • tmp-logs
  • v1.24-RC
  • v1.24.0
  • v1.24.1
  • v1.24.1-RC
  • v1.24.2
  • v1.25.1
  • v1.25.2
  • v1.25.3
  • v1.25.4
  • v1.26.0
  • v1.27.4.0.0
  • v1.27.4.0.0dev1
  • v1.27.4.0.0dev2
160 results
Show changes
This diff is collapsed.
......@@ -39,12 +39,7 @@ ENV user ${user}
## Add user ##
RUN groupadd --gid 1000 ${user} \
&& useradd --create-home --uid 1000 --gid ${user} ${user}
# Gitlab CI accepts only root user, so we don't set user here.
# You can (and should) run command in container as user `alice` this way:
# docker-compose run --rm --user=alice --name=myrunner runner /bin/bash
# USER ${user}
USER ${user}
WORKDIR /home/${user}
RUN chown -R ${user}:${user} /home/${user}
......
FROM python:3.6.12-buster
# For running python as non-root user, e.g. on devel machine.
# Setup python environment.
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONFAULTHANDLER 1
# Install debian packages.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
ca-certificates \
gnupg \
&& rm -rf /var/lib/apt/lists/*
# Install debian pgdg repository.
RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main" \
> /etc/apt/sources.list.d/pgdg.list
RUN apt-get update
# Install postgresql client programs for various postgresl versions.
RUN apt-get install -y --no-install-recommends \
postgresql-client-10 \
postgresql-client-11 \
postgresql-client-12 \
postgresql-client-13 \
&& rm -rf /var/lib/apt/lists/*
# Upgrade some crucial python packages.
RUN pip install --upgrade pip setuptools wheel
# Install python dependencies via pip.
RUN pip install pipenv poetry
ARG user
ENV user ${user}
## Add user ##
RUN groupadd --gid 1000 ${user} \
&& useradd --create-home --uid 1000 --gid ${user} ${user}
RUN mkdir -p /home/${user}/src/hivemind
RUN chown -R ${user}:${user} /home/${user}
WORKDIR /home/${user}/src/hivemind
USER ${user}
CMD [ "python3" ]
......@@ -39,12 +39,7 @@ ENV user ${user}
## Add user ##
RUN groupadd --gid 1000 ${user} \
&& useradd --create-home --uid 1000 --gid ${user} ${user}
# Gitlab CI accepts only root user, so we don't set user here.
# You can (and should) run command in container as user `alice` this way:
# docker-compose run --rm --user=alice --name=myrunner runner /bin/bash
# USER ${user}
USER ${user}
WORKDIR /home/${user}
RUN chown -R ${user}:${user} /home/${user}
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Tool for Gitlab runner to read environment from project variable
and setup bash environment.
When running on Gitlab CI you can do this:
```
eval "$(cat $MY_ENV_VARIABLE | ./scripts/ci/setup_env.py)"
echo "RUNNER_ID is $RUNNER_ID"
```
In bash you can do this:
```
eval "$(cat ./.tmp/env.yaml | ./scripts/ci/setup_env.py)"
echo "RUNNER_ID is $RUNNER_ID"
```
"""
import logging
import sys
import argparse
import yaml
FORMAT = '# %(asctime)s - %(name)s - %(levelname)s - %(message)s '
logging.basicConfig(format=FORMAT)
logger = logging.getLogger(__name__)
def output(message, outfile, end='\n'):
"""Print data to outfile"""
print(message, file=outfile, end=end)
def read(infile):
"""Read data from infile"""
if hasattr(infile, 'read'):
# data = json.loads(infile.read())
data = yaml.safe_load(infile.read())
else:
# data = json.loads(infile)
data = yaml.safe_load(infile)
return data
def setup_env(current_runner_id, hive_sync_runner_id, infile, outfile, end, **kwargs):
"""
Resolve and output environment for bash in pending CI job.
Assumption: all jobs in pipeline must use the same database.
We need to point current runner to the database used by runner,
that did hive sync (first stage in pipeline).
"""
logger.debug('current_runner_id: %s', current_runner_id)
logger.debug('hive_sync_runner_id: %s', hive_sync_runner_id)
data = read(infile)
logger.debug('data: %s', data)
current_runner = data['runners'][str(current_runner_id)]
if hive_sync_runner_id == 0:
hive_sync_runner = current_runner
else:
hive_sync_runner = data['runners'][str(hive_sync_runner_id)]
if hive_sync_runner_id == 0:
# Do nothing, obviously. Current runner does hive sync itself.
logger.debug('case 1')
runner = current_runner
elif current_runner_id == hive_sync_runner_id:
# Do nothing, obviously. Current runner is the same, as runner
# that did hive sync.
logger.debug('case 2')
runner = current_runner
else:
if current_runner['host'] == hive_sync_runner['host']:
# We assume that all executors on the same machine
# use the same postgres server with the same credentials
# and unix socket connection configuration. So do nothing.
logger.debug('case 3')
runner = current_runner
else:
# Take postgres stuff from runner that did hive sync,
# but point current runner to postgres on the host of runner
# that did hive sync (exposed on network, we assume).
logger.debug('case 4')
runner = {}
for key, value in current_runner.items():
if key.startswith('postgres'):
if key == 'postgres_host':
runner[key] = hive_sync_runner['host']
else:
runner[key] = hive_sync_runner[key]
else:
runner[key] = value
for key in runner:
output(
f'export RUNNER_{key.upper()}="{str(runner[key])}"',
outfile,
end,
)
for key in data['common']:
output(
f"export RUNNER_{key.upper()}=\"{str(data['common'][key])}\"",
outfile,
end,
)
def parse_args():
"""Parse command line arguments"""
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter
)
parser.add_argument(
'infile',
type=argparse.FileType('r'),
nargs='?',
default=sys.stdin,
help='Input file or pipe via STDIN'
)
parser.add_argument(
'-o', '--outfile',
type=argparse.FileType('w'),
default=sys.stdout,
help='Output file, STDOUT if not set'
)
parser.add_argument(
"-e", "--end",
dest='end',
default='\n',
help='String at the end of line in output'
)
parser.add_argument(
"-s", "--hive-sync-runner-id",
required=True,
type=int,
help='Id of runner which did hive sync, 0 when current runner does hive sync actually'
)
parser.add_argument(
"-c", "--current-runner-id",
required=True,
type=int,
help='Id of current runner'
)
parser.add_argument(
'--log-level',
default='INFO',
dest='log_level',
choices=['debug', 'info', 'warning', 'error'],
help='Log level (string)',
)
result = parser.parse_args()
# configure logger and print config
root = logging.getLogger()
root.setLevel(result.log_level.upper())
return result
def main():
"""Main dispatcher function"""
flags = parse_args()
setup_env(**vars(flags))
if __name__ == '__main__':
main()
#!/bin/bash
set -e
pip install tox
export HIVEMIND_ADDRESS=$1
export HIVEMIND_PORT=$2
ITERATIONS=$3
JOBS=${4:-auto}
export TAVERN_DISABLE_COMPARATOR=true
echo Attempting to start benchmarks on hivemind instance listening on: $HIVEMIND_ADDRESS port: $HIVEMIND_PORT
for (( i=0; i<$ITERATIONS; i++ ))
do
echo About to run iteration $i
tox -e tavern-benchmark -- \
-W ignore::pytest.PytestDeprecationWarning \
-n $JOBS \
--junitxml=../../../../benchmarks-$i.xml
echo Done!
done
#!/bin/bash
set -e
pip install tox
export HIVEMIND_ADDRESS=$1
export HIVEMIND_PORT=$2
TEST_GROUP=$3
JUNITXML=$4
JOBS=${5:-auto}
export TAVERN_DIR="tests/tests_api/hivemind/tavern"
echo "Starting tests on hivemind server running on ${HIVEMIND_ADDRESS}:${HIVEMIND_PORT}"
echo "Selected test group (if empty all will be executed): $3"
echo "Selected test group (if empty all will be executed): $TEST_GROUP"
tox -e tavern -- -W ignore::pytest.PytestDeprecationWarning -n auto --junitxml=../../../../$4 $3
tox -e tavern -- \
-W ignore::pytest.PytestDeprecationWarning \
-n $JOBS \
--junitxml=../../../../$JUNITXML $TEST_GROUP
......@@ -2,6 +2,8 @@
set -euo pipefail
JOB=$1
start() {
mkdir -p ".tmp"
echo `date +%s` > ".tmp/timer-start"
......@@ -18,4 +20,15 @@ check() {
fi
}
"$1"
main() {
if [ "$JOB" = "start" ]; then
start
elif [ "$JOB" = "check" ]; then
check
else
echo "Invalid argument"
exit 1
fi
}
main
......@@ -6,19 +6,26 @@
set -e
LIMIT=30 #seconds
shift
cmd="$@"
LIMIT=10 #seconds
HOST=$1
PORT=$2
if [ -z "$HOST" ]
then
HOST="$RUNNER_POSTGRES_HOST"
fi
if [ -z "$PORT" ]
then
PORT="$RUNNER_POSTGRES_PORT"
fi
wait_for_postgres() {
# wkedzierski@syncad.com work, but customized by wbarcik@syncad.com
counter=0
echo "Waiting for postgres on ${POSTGRES_HOST}:${POSTGRES_PORT}. Timeout is ${LIMIT}s."
echo "Waiting for postgres on ${HOST}:${PORT}."
while ! pg_isready \
--username $ADMIN_POSTGRES_USER \
--host $POSTGRES_HOST \
--port $POSTGRES_PORT \
--dbname postgres \
--host $HOST \
--port $PORT \
--timeout=1 --quiet; do
counter=$((counter+1))
sleep 1
......@@ -38,14 +45,15 @@ output_configuration() {
echo "-------------------------------------------------"
echo "Postgres version and configuration"
echo "-------------------------------------------------"
PGPASSWORD=$ADMIN_POSTGRES_USER_PASSWORD psql \
--username "$ADMIN_POSTGRES_USER" \
--host "$POSTGRES_HOST" \
--port $POSTGRES_PORT \
PGPASSWORD=$RUNNER_POSTGRES_ADMIN_USER_PASSWORD psql \
--username "$RUNNER_POSTGRES_ADMIN_USER" \
--host "$HOST" \
--port $PORT \
--dbname postgres <<EOF
SELECT version();
select name, setting, unit from pg_settings;
\copy (select * from pg_settings) to '$DIR/pg_settings_on_start.csv' WITH CSV HEADER
-- select name, setting, unit from pg_settings;
-- show all;
\copy (select name, setting, unit from pg_settings) to '$DIR/pg_settings_on_start.csv' WITH CSV HEADER
\q
EOF
echo "-------------------------------------------------"
......
......@@ -91,9 +91,14 @@ if __name__ == "__main__":
'pdoc',
'diff-match-patch',
'prometheus-client',
'psutil'
'psutil',
],
extras_require={
'dev': [
'pyYAML',
'prettytable',
]
},
entry_points={
'console_scripts': [
'hive=hive.cli:run',
......
Subproject commit c9a3f6ecc01e3bed1098bf9698e95002ccdd47d6
Subproject commit e8f2e1810071df5659edb45edf3d59af4b9be48e
......@@ -3,7 +3,7 @@ envlist = py36, tavern, benchmark, tavern-benchmark
skipsdist = true
[testenv]
deps =
deps =
pytest
[testenv:benchmark]
......@@ -11,13 +11,13 @@ deps =
{[testenv]deps}
pytest-benchmark
requests
pyyaml
pyYAML
prettytable
commands =
python {toxinidir}/scripts/ci/start_api_benchmark.py {posargs}
[testenv:tavern]
setenv =
setenv =
PYTHONPATH = {toxinidir}/tests/tests_api/hivemind/tavern:{env:PYTHONPATH:}
passenv =
......@@ -26,7 +26,7 @@ passenv =
changedir = {env:TAVERN_DIR}
deps =
deps =
{[testenv]deps}
pytest-xdist
tavern
......@@ -36,7 +36,7 @@ deps =
commands = pytest {posargs}
[testenv:tavern-benchmark]
setenv =
setenv =
{[testenv:tavern]setenv}
passenv =
......@@ -45,7 +45,7 @@ passenv =
changedir = tests/tests_api/hivemind/tavern
deps =
deps =
{[testenv:tavern]deps}
commands = pytest --durations=0 {posargs}