|
a |
|
b/scripts/qiita-cron-job |
|
|
1 |
#!/usr/bin/env python |
|
|
2 |
|
|
|
3 |
# ----------------------------------------------------------------------------- |
|
|
4 |
# Copyright (c) 2014--, The Qiita Development Team. |
|
|
5 |
# |
|
|
6 |
# Distributed under the terms of the BSD 3-clause License. |
|
|
7 |
# |
|
|
8 |
# The full license is in the file LICENSE, distributed with this software. |
|
|
9 |
# ----------------------------------------------------------------------------- |
|
|
10 |
|
|
|
11 |
import click |
|
|
12 |
|
|
|
13 |
from qiita_db.util import ( |
|
|
14 |
purge_filepaths as qiita_purge_filepaths, |
|
|
15 |
empty_trash_upload_folder as qiita_empty_trash_upload_folder, |
|
|
16 |
quick_mounts_purge as qiita_quick_mounts_purge) |
|
|
17 |
from qiita_db.meta_util import ( |
|
|
18 |
update_redis_stats as qiita_update_redis_stats, |
|
|
19 |
update_resource_allocation_redis as qiita_update_resource_allocation_redis, |
|
|
20 |
generate_biom_and_metadata_release as |
|
|
21 |
qiita_generate_biom_and_metadata_release, |
|
|
22 |
generate_plugin_releases as qiita_generate_plugin_releases) |
|
|
23 |
from qiita_db.download_link import DownloadLink |
|
|
24 |
|
|
|
25 |
|
|
|
26 |
@click.group() |
|
|
27 |
def commands(): |
|
|
28 |
pass |
|
|
29 |
|
|
|
30 |
|
|
|
31 |
@commands.command() |
|
|
32 |
@click.option('--remove/--no-remove', default=True, |
|
|
33 |
help='remove any filepaths from the qiita.filepath table that ' |
|
|
34 |
'are not linked to any other table') |
|
|
35 |
def purge_filepaths(remove): |
|
|
36 |
qiita_purge_filepaths(remove) |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
@commands.command() |
|
|
40 |
@click.option('--remove/--no-remove', default=True, |
|
|
41 |
help='remove files from the trash folder within the upload ' |
|
|
42 |
'folders') |
|
|
43 |
def empty_trash_upload_folder(remove): |
|
|
44 |
qiita_empty_trash_upload_folder(remove) |
|
|
45 |
|
|
|
46 |
|
|
|
47 |
@commands.command() |
|
|
48 |
def update_redis_stats(): |
|
|
49 |
qiita_update_redis_stats() |
|
|
50 |
|
|
|
51 |
|
|
|
52 |
@commands.command() |
|
|
53 |
def update_resource_allocation_redis(): |
|
|
54 |
qiita_update_resource_allocation_redis() |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
@commands.command() |
|
|
58 |
def generate_biom_and_metadata_release(): |
|
|
59 |
qiita_generate_biom_and_metadata_release('public') |
|
|
60 |
|
|
|
61 |
|
|
|
62 |
@commands.command() |
|
|
63 |
def purge_json_web_tokens(): |
|
|
64 |
DownloadLink.delete_expired() |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
@commands.command() |
|
|
68 |
def generate_plugin_releases(): |
|
|
69 |
qiita_generate_plugin_releases() |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
@commands.command() |
|
|
73 |
def quick_mounts_purge(): |
|
|
74 |
print(qiita_quick_mounts_purge()) |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
if __name__ == "__main__": |
|
|
78 |
commands() |