Skip to content

Instantly share code, notes, and snippets.

@cinek810
Last active December 13, 2018 16:37
Show Gist options
  • Save cinek810/8d181d7319aa6f5accd18a447d336872 to your computer and use it in GitHub Desktop.
Save cinek810/8d181d7319aa6f5accd18a447d336872 to your computer and use it in GitHub Desktop.
Script developed for funinit.wordpress.com
#!/bin/bash
# Author: Marcin Stolarek
#############################
START="2018-11-02"
END="2018-11-06"
RESOURCE="Cluster"
MYSQL_REMOVE=$(mktemp)
cat << END > $MYSQL_REMOVE
delete from mod_shredder.shredded_job_slurm where start_time > UNIX_TIMESTAMP('$START') and end_time < UNIX_TIMESTAMP('$END') and cluster_name = '$RESOURCE';
delete from mod_shredder.shredded_job where resource_name='$RESOURCE' and start_time > UNIX_TIMESTAMP('$START') and end_time < UNIX_TIMESTAMP('$END');
delete from mod_shredder.staging_job where resource_name='$RESOURCE' and start_time > UNIX_TIMESTAMP('$START') and end_time < UNIX_TIMESTAMP('$END');
delete from mod_hpcdb.hpcdb_jobs where resource_id=( SELECT resource_id FROM mod_hpcdb.hpcdb_resources where resource_code = "$RESOURCE" ) and start_time > UNIX_TIMESTAMP('$START') and end_time < UNIX_TIMESTAMP('$END');
delete from modw.jobfact where resource_id=( SELECT resource_id FROM mod_hpcdb.hpcdb_resources where resource_code = "$RESOURCE" ) and start_time > '$START' and end_time < '$END';
END
cat $MYSQL_REMOVE | mysql
/usr/bin/xdmod-ingestor --start-time "${START}" --end-time "${END}" --debug > /tmp/xdmod-ingestor-remove.debug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment