def unlink(self, path): print '*** unlink', path from DIRAC.DataManagementSystem.Client.FileCatalogClientCLI import FileCatalogClientCLI from COMDIRAC.Interfaces import DCatalog fcc = FileCatalogClientCLI(DCatalog().catalog) fcc.do_rm(path) return 0
def unlink ( self, path ): print '*** unlink', path from DIRAC.DataManagementSystem.Client.FileCatalogClientCLI import FileCatalogClientCLI from COMDIRAC.Interfaces import DCatalog fcc = FileCatalogClientCLI( DCatalog().catalog ) fcc.do_rm(path) return 0
def release(self, path, flags): print '*** release', path, flags #if self.file[path]["mode"]&(stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH): # return -errno.EACCES #print self.file[path] if self.file[path]["modified"]: self.file[path]["handler"].seek(0) off = 1 if self.file[path]["handler"].read(1) == '\0' else 0 tmp = str(time.time()) + str(random.random()) f = open(self.tmpdir + '/' + tmp, "w+b") self.file[path]["handler"].seek(off) f.write(self.file[path]["handler"].read()) f.close() from DIRAC.DataManagementSystem.Client.FileCatalogClientCLI import FileCatalogClientCLI from COMDIRAC.Interfaces import DCatalog fcc = FileCatalogClientCLI(DCatalog().catalog) fcc.do_rm(path) fcc.do_add(path + " " + self.tmpdir + "/" + tmp + " " + self.SE) os.remove(self.tmpdir + '/' + tmp) self.file[path]["handler"].close() del self.file[path] return 0
def release ( self, path, flags ): print '*** release', path, flags #if self.file[path]["mode"]&(stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH): # return -errno.EACCES #print self.file[path] if self.file[path]["modified"]: self.file[path]["handler"].seek(0) off = 1 if self.file[path]["handler"].read(1) == '\0' else 0 tmp = str(time.time())+str(random.random()) f = open(self.tmpdir+'/'+tmp,"w+b") self.file[path]["handler"].seek(off) f.write(self.file[path]["handler"].read()) f.close() from DIRAC.DataManagementSystem.Client.FileCatalogClientCLI import FileCatalogClientCLI from COMDIRAC.Interfaces import DCatalog fcc = FileCatalogClientCLI( DCatalog().catalog ) fcc.do_rm(path) fcc.do_add( path+" "+self.tmpdir+"/"+tmp+" "+self.SE ) os.remove(self.tmpdir+'/'+tmp) self.file[path]["handler"].close() del self.file[path] return 0