-
Couldn't load subscription status.
- Fork 79
split qiita cron job #2543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
split qiita cron job #2543
Changes from 10 commits
1c87f00
ff87431
b1924c3
5e0f643
1d54381
b9a2cba
39cc48d
d1d5e44
7bad458
eb62b96
ed78f0a
6d72398
59b9bcb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,31 +8,55 @@ | |
| # The full license is in the file LICENSE, distributed with this software. | ||
| # ----------------------------------------------------------------------------- | ||
|
|
||
| import click | ||
|
|
||
| from qiita_db.util import ( | ||
| purge_filepaths, empty_trash_upload_folder, purge_files_from_filesystem) | ||
| purge_filepaths as qiita_purge_filepaths, | ||
| empty_trash_upload_folder as qiita_empty_trash_upload_folder, | ||
| purge_files_from_filesystem as qiita_purge_files_from_filesystem) | ||
| from qiita_db.meta_util import ( | ||
| update_redis_stats, generate_biom_and_metadata_release) | ||
| update_redis_stats as qiita_update_redis_stats, | ||
| generate_biom_and_metadata_release as | ||
| qiita_generate_biom_and_metadata_release) | ||
|
|
||
|
|
||
| # This script will perform these jobs: | ||
| # 1. purge_filepaths: remove files from that are leftover in the | ||
| # qiita.filepath and are present in the filesystem | ||
| # 2. empty_trash_upload_folder: remove files that are present in the trash | ||
| # of the upload folders | ||
| # 3. update_redis_stats: updates the redis stats information | ||
| # 4. generate public releases of biom tables and metadata | ||
| # | ||
| # Note that is responsability of the Qiita install system admin to add to a | ||
| # cron job this script and responsible to define how often it should run | ||
| @click.group() | ||
| def commands(): | ||
| pass | ||
|
|
||
|
|
||
| @commands.command() | ||
| @click.option('--remove/--no-remove', default=True, | ||
| help=('remove files from that are leftover in the ' | ||
|
||
| 'qiita.filepath and are present in the filesystem')) | ||
| def purge_filepaths(remove): | ||
| qiita_purge_filepaths(remove) | ||
|
|
||
|
|
||
| @commands.command() | ||
| @click.option('--remove/--no-remove', default=False, | ||
| help='check the filesystem and remove not used') | ||
|
||
| def purge_files_from_filesystem(remove): | ||
| qiita_purge_files_from_filesystem(remove) | ||
|
|
||
|
|
||
| @commands.command() | ||
| @click.option('--remove/--no-remove', default=True, | ||
| help=('remove files from the trash folder within the upload ' | ||
|
||
| 'folders')) | ||
| def empty_trash_upload_folder(remove): | ||
| qiita_empty_trash_upload_folder(remove) | ||
|
|
||
|
|
||
| @commands.command() | ||
| def update_redis_stats(): | ||
| qiita_update_redis_stats() | ||
|
|
||
|
|
||
| def main(): | ||
| purge_filepaths(True) | ||
| purge_files_from_filesystem(False) | ||
| empty_trash_upload_folder(True) | ||
| update_redis_stats() | ||
| generate_biom_and_metadata_release('public') | ||
| @commands.command() | ||
| def generate_biom_and_metadata_release(): | ||
| qiita_generate_biom_and_metadata_release('public') | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
| commands() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make sense to pack this into a single script so it doesn't lead to a such a long single line in the configuration file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure ... if you feel strong about it ... let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinking about it, this might be useful for other reasons, just added.