-
Notifications
You must be signed in to change notification settings - Fork 149
/
PyXRootDCopyProcess.cc
executable file
·80 lines (73 loc) · 3.34 KB
/
PyXRootDCopyProcess.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//------------------------------------------------------------------------------
// Copyright (c) 2012-2013 by European Organization for Nuclear Research (CERN)
// Author: Justin Salmon <jsalmon@cern.ch>
//------------------------------------------------------------------------------
// XRootD 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.
//
// XRootD 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 General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
#include "PyXRootDCopyProcess.hh"
#include "Conversions.hh"
namespace PyXRootD
{
//----------------------------------------------------------------------------
// Add a job to the copy process
//----------------------------------------------------------------------------
PyObject* CopyProcess::AddJob( CopyProcess *self, PyObject *args, PyObject *kwds )
{
static char *kwlist[] = { "source", "target", "sourcelimit", "force",
"posc", "coerce", "thirdparty", "checksumprint",
"chunksize", "parallelchunks", NULL };
const char *source;
const char *target;
uint16_t sourceLimit = 1;
bool force = false;
bool posc = false;
bool coerce = false;
bool thirdParty = false;
bool checkSumPrint = false;
uint32_t chunkSize = 4194304;
uint8_t parallelChunks = 8;
if ( !PyArg_ParseTupleAndKeywords( args, kwds, "ss|HbbbbbIb:add_job", kwlist,
&source, &target, &sourceLimit, &force, &posc, &coerce, &thirdParty,
&checkSumPrint, &chunkSize, ¶llelChunks ) )
return NULL;
XrdCl::JobDescriptor *job = new XrdCl::JobDescriptor();
job->source = XrdCl::URL( source );
job->target = XrdCl::URL( target );
job->sourceLimit = sourceLimit;
job->force = force;
job->posc = posc;
job->coerce = coerce;
job->thirdParty = thirdParty;
job->checkSumPrint = checkSumPrint;
self->process->AddJob( job );
Py_RETURN_NONE;
}
//----------------------------------------------------------------------------
// Prepare the copy jobs
//----------------------------------------------------------------------------
PyObject* CopyProcess::Prepare( CopyProcess *self, PyObject *args, PyObject *kwds )
{
XrdCl::XRootDStatus status = self->process->Prepare();
return ConvertType<XrdCl::XRootDStatus>( &status );
}
//----------------------------------------------------------------------------
// Run the copy jobs
//----------------------------------------------------------------------------
PyObject* CopyProcess::Run( CopyProcess *self, PyObject *args, PyObject *kwds )
{
XrdCl::CopyProgressHandler *handler = new PyCopyProgressHandler();
XrdCl::XRootDStatus status = self->process->Run( handler );
return ConvertType<XrdCl::XRootDStatus>( &status );
}
}