Diff of /scripts/qiita-cron-job [000000] .. [879b32]

Switch to side-by-side view

--- a
+++ b/scripts/qiita-cron-job
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+
+# -----------------------------------------------------------------------------
+# Copyright (c) 2014--, The Qiita Development Team.
+#
+# Distributed under the terms of the BSD 3-clause License.
+#
+# The full license is in the file LICENSE, distributed with this software.
+# -----------------------------------------------------------------------------
+
+import click
+
+from qiita_db.util import (
+    purge_filepaths as qiita_purge_filepaths,
+    empty_trash_upload_folder as qiita_empty_trash_upload_folder,
+    quick_mounts_purge as qiita_quick_mounts_purge)
+from qiita_db.meta_util import (
+    update_redis_stats as qiita_update_redis_stats,
+    update_resource_allocation_redis as qiita_update_resource_allocation_redis,
+    generate_biom_and_metadata_release as
+    qiita_generate_biom_and_metadata_release,
+    generate_plugin_releases as qiita_generate_plugin_releases)
+from qiita_db.download_link import DownloadLink
+
+
+@click.group()
+def commands():
+    pass
+
+
+@commands.command()
+@click.option('--remove/--no-remove', default=True,
+              help='remove any filepaths from the qiita.filepath table that '
+              'are not linked to any other table')
+def purge_filepaths(remove):
+    qiita_purge_filepaths(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()
+
+
+@commands.command()
+def update_resource_allocation_redis():
+    qiita_update_resource_allocation_redis()
+
+
+@commands.command()
+def generate_biom_and_metadata_release():
+    qiita_generate_biom_and_metadata_release('public')
+
+
+@commands.command()
+def purge_json_web_tokens():
+    DownloadLink.delete_expired()
+
+
+@commands.command()
+def generate_plugin_releases():
+    qiita_generate_plugin_releases()
+
+
+@commands.command()
+def quick_mounts_purge():
+    print(qiita_quick_mounts_purge())
+
+
+if __name__ == "__main__":
+    commands()