mirror of https://github.com/BOINC/boinc.git
- scheduler: add feature for deleting no-longer-used sticky files.
Create a file "file_delete_regex" in your project dir. Each line is a regular expression. Any sticky file whose name matches one of the expressions is deleted.
This commit is contained in:
parent
eea35c152e
commit
450c5592ae
|
@ -149,14 +149,15 @@ cgi_sources = \
|
|||
hr.cpp \
|
||||
hr_info.cpp \
|
||||
plan_class_spec.cpp \
|
||||
sched_main.cpp \
|
||||
sched_array.cpp \
|
||||
sched_assign.cpp \
|
||||
sched_customize.cpp \
|
||||
sched_files.cpp \
|
||||
sched_hr.cpp \
|
||||
sched_resend.cpp \
|
||||
sched_limit.cpp \
|
||||
sched_locality.cpp \
|
||||
sched_main.cpp \
|
||||
sched_resend.cpp \
|
||||
sched_result.cpp \
|
||||
sched_score.cpp \
|
||||
sched_send.cpp \
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "sched_vda.h"
|
||||
|
||||
#include "credit.h"
|
||||
#include "sched_files.h"
|
||||
#include "sched_main.h"
|
||||
#include "sched_types.h"
|
||||
#include "sched_util.h"
|
||||
|
@ -1101,6 +1102,10 @@ void process_request(char* code_sign_key) {
|
|||
|
||||
memset(&g_reply->wreq, 0, sizeof(g_reply->wreq));
|
||||
|
||||
// if client has sticky files we don't need any more, tell it
|
||||
//
|
||||
do_file_delete_regex();
|
||||
|
||||
// if different major version of BOINC, just send a message
|
||||
//
|
||||
if (wrong_core_client_version()
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
// This file is part of BOINC.
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2013 University of California
|
||||
//
|
||||
// BOINC is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// BOINC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
#include "sched_msgs.h"
|
||||
#include "sched_types.h"
|
||||
#include "str_util.h"
|
||||
|
||||
#include "sched_files.h"
|
||||
|
||||
std::vector<regex_t> file_delete_regex;
|
||||
|
||||
int init_file_delete_regex() {
|
||||
char buf[256];
|
||||
FILE* f = fopen("../file_delete_regex", "r");
|
||||
if (!f) return 0;
|
||||
while (fgets(buf, sizeof(buf), f)) {
|
||||
strip_whitespace(buf);
|
||||
if (!strlen(buf)) continue;
|
||||
regex_t re;
|
||||
if (regcomp(&re, buf, REG_EXTENDED|REG_NOSUB)) {
|
||||
log_messages.printf(MSG_CRITICAL,
|
||||
"invalid regular expression in file_delete_regex: %s\n", buf
|
||||
);
|
||||
} else {
|
||||
file_delete_regex.push_back(re);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int do_file_delete_regex() {
|
||||
for (unsigned int i=0; i<g_request->file_infos.size(); i++) {
|
||||
FILE_INFO& fi = g_request->file_infos[i];
|
||||
for (unsigned int j=0; j<file_delete_regex.size(); j++) {
|
||||
regex_t& re = file_delete_regex[j];
|
||||
if (regexec(&re, fi.name, 0, NULL, 0)) {
|
||||
g_reply->file_deletes.push_back(fi);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
// This file is part of BOINC.
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2013 University of California
|
||||
//
|
||||
// BOINC is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// BOINC is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
extern int init_file_delete_regex();
|
||||
extern int do_file_delete_regex();
|
|
@ -43,22 +43,23 @@
|
|||
#include <sys/resource.h>
|
||||
|
||||
#include "boinc_db.h"
|
||||
#include "parse.h"
|
||||
#include "filesys.h"
|
||||
#include "error_numbers.h"
|
||||
#include "filesys.h"
|
||||
#include "parse.h"
|
||||
#include "shmem.h"
|
||||
#include "util.h"
|
||||
#include "str_util.h"
|
||||
#include "synch.h"
|
||||
#include "svn_version.h"
|
||||
#include "synch.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "sched_config.h"
|
||||
#include "sched_types.h"
|
||||
#include "handle_request.h"
|
||||
#include "sched_util.h"
|
||||
#include "sched_config.h"
|
||||
#include "sched_files.h"
|
||||
#include "sched_msgs.h"
|
||||
#include "sched_main.h"
|
||||
#include "sched_types.h"
|
||||
#include "sched_util.h"
|
||||
|
||||
#include "sched_main.h"
|
||||
|
||||
// Useful for debugging, if your cgi script keeps crashing. This
|
||||
// makes it dump a core file that you can load into a debugger to see
|
||||
|
@ -494,6 +495,7 @@ int main(int argc, char** argv) {
|
|||
|
||||
gui_urls.init();
|
||||
project_files.init();
|
||||
init_file_delete_regex();
|
||||
|
||||
sprintf(path, "%s/code_sign_public", config.key_dir);
|
||||
retval = read_file_malloc(path, code_sign_key);
|
||||
|
|
Loading…
Reference in New Issue