<commit_before>#!/usr/local/bin/python
#----------------------------------------------------------------------------------------------------
# This script looks at the results of deletion suggestions for a specified site and actually asks
# PhEDEx for deletions.  The PhEDEx communications are handled inside PhEDExAPI class.
#
#  The deletion request would have to approved by sysadmins At the moment deletion requests will go
# to T2_US_MIT, T2_US_Nebraska, and T2_DE_RWTH.
#
# ToDo: If needed, we will add a mechanism to maintain a local list of submitted subscriptions so
# that we will NOT ask again if it looks like there is orginal request submitted earlier still
# pending for approval.
#
#----------------------------------------------------------------------------------------------------
import sys, os, re, glob, time, glob, shutil
import datetime
from   datetime import date, timedelta
from phedexApi import phedexApi

#====================================================================================================
#  H E L P E R S
#====================================================================================================
def submitRequest(site, datasets=[]):
    
    if len(datasets) < 1:
        print " ERROR - Trying to submit empty request for " + site
        return

    phedex = phedexApi(logPath='./')

    # compose data for deletion request
    check,data = phedex.xmlData(datasets=datasets,instance='prod')

    if check: 
        print " ERROR - phedexApi.xmlData failed"
        sys.exit(1)

    # here the request is really sent
    check,response = phedex.delete(node=site,data=data,\
                       comments='IntelROOCS -- Automatic Cache Release Request'+\
                       '(if not acted upon will repeat in about 6 hours)',
                       instance='prod')
    if check:
        print " ERROR - phedexApi.delete failed"
        print response
        sys.exit(1)
<commit_msg>Next version of Detox with bug fix. Some issues for Max to review.<commit_after>#!/usr/local/bin/python
#----------------------------------------------------------------------------------------------------
# This script looks at the results of deletion suggestions for a specified site and actually asks
# PhEDEx for deletions.  The PhEDEx communications are handled inside PhEDExAPI class.
#
#  The deletion request would have to approved by sysadmins At the moment deletion requests will go
# to T2_US_MIT, T2_US_Nebraska, and T2_DE_RWTH.
#
# ToDo: If needed, we will add a mechanism to maintain a local list of submitted subscriptions so
# that we will NOT ask again if it looks like there is orginal request submitted earlier still
# pending for approval.
#
#----------------------------------------------------------------------------------------------------
import sys, os, re, glob, time, glob, shutil
import datetime
from   datetime import date, timedelta
from phedexApi import phedexApi

#====================================================================================================
#  H E L P E R S
#====================================================================================================
def submitRequest(site, datasets=[]):

    if len(datasets) < 1:
        print " ERROR - Trying to submit empty request for " + site
        return

    phedex = phedexApi(logPath='./')

    # compose data for deletion request
    check,data = phedex.xmlData(datasets=datasets,instance='prod')

    if check: 
        print " ERROR - phedexApi.xmlData failed"
        sys.exit(1)

    # here the request is really sent
    check,response = phedex.delete(node=site,data=data,\
                       comments='IntelROOCS -- Automatic Cache Release Request'+\
                       '(if not acted upon will repeat in about %d hours)'\
                                   %(os.environ['DETOX_CYCLE_HOURS']),
                       instance='prod')
    if check:
        print " ERROR - phedexApi.delete failed"
        print response
        sys.exit(1)

{'fraction_non_alphanumeric': 0.25939756036843414, 'fraction_numerical': 0.003236245954692557, 'mean_word_length': 2.201593625498008, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2610834', 'n_tokens_mistral': 983, 'n_tokens_neox': 899, 'n_words': 367}