Skip to content

Commit 172efb6

Browse files
committed
[IMP] runbot: add time on logs
1 parent 992ffa0 commit 172efb6

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

runbot/models/build_config.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
PYTHON_DEFAULT = "# type python code here\n\n\n\n\n\n"
5353

5454

55+
def echo(text):
56+
return f'echo $(date -u "+%Y-%m-%d %H:%M:%S,%3N") {text}'
57+
58+
5559
def filter_all_modules(selector, build, dynamic_vars):
5660
if selector.split(',', 1)[0] != '*':
5761
selector = f'*,{selector}'
@@ -863,9 +867,13 @@ def _add_zip_generation(self, build, cmd, db_name):
863867
filestore_path = '/data/build/datadir/filestore/%s' % db_name
864868
filestore_dest = '%s/filestore/' % dump_dir
865869
zip_path = '/data/build/logs/%s.zip' % db_name
870+
cmd.finals.append([echo('### Generating dump')])
866871
cmd.finals.append(['pg_dump', db_name, '>', sql_dest])
872+
cmd.finals.append([echo('### Copying filestore')])
867873
cmd.finals.append(['cp', '-r', filestore_path, filestore_dest])
874+
cmd.finals.append([echo('### Generaing zip')])
868875
cmd.finals.append(['cd', dump_dir, '&&', 'zip', '-rmq9', zip_path, '*'])
876+
cmd.finals.append([echo('### Done')])
869877
infos = '{\n "db_name": "%s",\n "build_id": %s,\n "shas": [%s]\n}' % (db_name, build.id, ', '.join(['"%s"' % build_commit.commit_id.dname for build_commit in build.params_id.commit_link_ids]))
870878
build._write_file('logs/%s/info.json' % db_name, infos)
871879

@@ -1172,22 +1180,23 @@ def _run_restore(self, build, config_data=None):
11721180
cmd = ' && '.join([
11731181
'mkdir /data/build/restore',
11741182
'cd /data/build/restore',
1183+
echo('### getting archive'),
11751184
'wget --retry-on-host-error %s' % dump_url,
11761185
'unzip -q %s' % zip_name,
1177-
'echo "### restoring filestore"',
1186+
echo('### restoring filestore'),
11781187
'mkdir -p /data/build/datadir/filestore/%s' % restore_db_name,
11791188
'mv filestore/* /data/build/datadir/filestore/%s' % restore_db_name,
1180-
'echo "### restoring db"',
1189+
echo('### restoring db'),
11811190
'createdb %s -T %s' % (restore_db_name, db_template),
11821191
'psql -q %s < dump.sql' % (restore_db_name),
1183-
'echo "### performing an analyze"',
1192+
echo('### performing an analyze'),
11841193
'psql -q -d %s -c "ANALYZE;"' % restore_db_name,
11851194
'cd /data/build',
1186-
'echo "### cleaning"',
1195+
echo('### cleaning'),
11871196
'rm -r restore',
1188-
'echo "### listing modules"',
1197+
echo('### listing modules'),
11891198
"""psql %s -c "select name from ir_module_module where state = 'installed'" -t -A > /data/build/logs/restore_modules_installed.txt""" % restore_db_name,
1190-
'echo "### restore" "successful"', # two part string to avoid miss grep
1199+
echo('### restore" "successful'), # two part string to avoid miss grep
11911200
])
11921201

11931202
return dict(cmd=cmd, network_enabled=True)

0 commit comments

Comments
 (0)