ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/LFNBaseName.py
(Generate patch)

Comparing COMP/CRAB/python/LFNBaseName.py (file contents):
Revision 1.22 by spiga, Tue May 26 10:23:01 2009 UTC vs.
Revision 1.23.2.2 by spiga, Mon Oct 12 13:42:08 2009 UTC

# Line 16 | Line 16 | def LFNBase(forced_path, PrimaryDataset=
16          PrimaryDataset = ProcessedDataset
17      if PrimaryDataset != '':
18          if ( PrimaryDataset[0] == '/' ):  PrimaryDataset=PrimaryDataset[1:]  
19 <    lfnbase = os.path.join(forced_path, getUserName(), PrimaryDataset, ProcessedDataset)
20 <
19 >    if forced_path.find('store/group')>0:
20 >        lfnbase = os.path.join(forced_path, PrimaryDataset, ProcessedDataset)
21 >    else:
22 >        lfnbase = os.path.join(forced_path, getUserName(), PrimaryDataset, ProcessedDataset)
23 >    if (publish == True):
24 >        checkSlash(ProcessedDataset)
25 >        checkLength(lfnbase, forced_path, PrimaryDataset, ProcessedDataset)
26      return lfnbase
27  
28 + def checkSlash(ProcessedDataset):
29 +    """
30 +    check if [USER].publish_data_name contains not allowed slash
31 +    """
32 +    
33 +    if (str(ProcessedDataset).find("/") > -1):
34 +            raise CrabException("Warning: [USER] publication_data_name contains a '/' characters that is not allowed. Please change the publication_data_name value")
35 +
36 + def checkLength(lfnbase, forced_path, PrimaryDataset, ProcessedDataset):
37 +    """
38 +    """
39 +    
40 +    len_primary = len(PrimaryDataset)
41 +    
42 +    common.logger.debug("CheckLength of LFN and User DatasetName")
43 +    common.logger.debug("max length for complete LFN is 500 characters, max length for primary dataset is 100 characters")
44 +    common.logger.debug("PrimaryDataset = " + PrimaryDataset)
45 +    common.logger.debug("len_primary = " + str(len_primary))
46 +
47 +    if (len_primary > 100):
48 +       raise CrabException("Warning: you required user_data_publication. The PrimaryDatasetName has to be < 100 characters")
49 +    
50 +    if (PrimaryDataset != ProcessedDataset):
51 +        common.logger.debug("ProcessedDataset = " + ProcessedDataset)
52 +        common.logger.debug("len(ProcessedDataset) = " + str(len(ProcessedDataset)))
53 +
54 +    common.logger.debug("forced_path = " + forced_path)
55 +    common.logger.debug("len(forced_path) = " + str(len(forced_path)))    
56 +    
57 +    user = getUserName()
58 +    len_user_name = len(user)
59 +    common.logger.debug("user = " + user)
60 +    common.logger.debug("len_user_name = " + str(len_user_name))
61 +    
62 +    common.logger.debug("lfnbase = " + lfnbase)
63 +    common.logger.debug("len(lfnbase) = " + str(len(lfnbase)))
64 +    
65 +    ### we suppose a output_file_name of 50 characters ###
66 +    if len(lfnbase)>450:
67 +        if (PrimaryDataset != ProcessedDataset):
68 +            #500 - len_user_name - len_primary - len(forced) - len(PSETHASH = 32) - 4(/) - output(50)
69 +            #~400 - len_user_name - len_primary - len(forced)
70 +            if (len(ProcessedDataset) > (400 - len_user_name - len_primary - len(forced_path))):
71 +                raise CrabException("Warning: publication name too long. USER.publish_data_name has to be < " + str(400 - len_user_name - len_primary - len(forced_path)) + " characters")
72 +            else:
73 +                raise CrabException("Warning: LFN > 500 characters")
74 +        else:
75 +            if (len(ProcessedDataset) > (400 - len_user_name - len(forced_path)) / 2):
76 +                raise CrabException("Warning: publication name too long. USER.publish_data_name has to be < " + str((400 - len_user_name - len(forced_path)) / 2) + " characters")
77 +            else:
78 +                raise CrabException("Warning: LFN > 500 characters")
79 +            
80  
81   if __name__ == '__main__' :
82      """

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines