Class TransferScheduler
java.lang.Object
ecmwf.common.technical.ThreadService.ConfigurableRunnable
ecmwf.common.technical.WakeupThread
ecmwf.common.ecaccess.ECaccessScheduler
ecmwf.common.ecaccess.MBeanScheduler
ecmwf.ecpds.master.transfer.TransferScheduler
- All Implemented Interfaces:
MBeanService
,MonitorCallback
,Closeable
,AutoCloseable
,Runnable
The Class TransferScheduler.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
The Class AcquisitionResult.static final class
The Class BackupResult.final class
The Class DestinationThread.static final class
The Class DownloadResult.static final class
The Class ExecutionResult.static final class
The Class FilterResult.class
The Class MonitoringThread.static final class
The Class PurgeResult.static final class
The Class ReplicateResult. -
Field Summary
Fields inherited from class ecmwf.common.ecaccess.ECaccessScheduler
NEXT_STEP_ABORT, NEXT_STEP_CONTINUE, NEXT_STEP_DELAY, NEXT_STEP_INIT, SCHEDULER_STATE_CLOSING, SCHEDULER_STATE_JAMMED, SCHEDULER_STATE_OFFLINE, SCHEDULER_STATE_ONHOLD, SCHEDULER_STATE_ONLINE, SCHEDULER_STATE_OPENING, states, steps
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacquisition
(StatusUpdate out, String destinationName, Host host, String source, String pattern, boolean synchronous) Version 1 is getting the list as an array of String and version 2 is getting the list as an InputStream.backup
(Host hostForBackup, TransferServer[] servers, DataTransfer transfer) Backup.static void
check
(TransferServer server, long ticket) Check.static void
check
(ProxySocket proxySocket) Check.static void
del
(TransferServer server, Host host, String source) Del.download
(DataTransfer transfer, Host hostForSource, List<DataTransfer> relatedTransfers) Download.execution
(StatusUpdate out, String destinationName, Host host, String script) Executing script against data mover (this is because the script might open a connection to a remote site to get the list of files to retrieve).filter
(TransferServer[] serversList, DataFile dataFile, boolean remove) Filter.static ProxySocket
get
(DataTransfer transfer, long remotePosn, long length) Gets a ProxySocket to download a DataTransfer.static ProxySocket
get
(TransferServer server, Host host, String source, long remotePosn, long length, boolean removeOriginal) Gets the.Gets the activity.getAttribute
(String attributeName) Gets the attribute.getDestinationLastTransfer
(String destinationName, boolean ok) Gets the destination last transfer.Gets the destinations.getDestinationStatus
(String destinationName) Gets the destination status.getDestinationStatus
(String destinationName, String statusCode) Gets the destination status.getDestinationThread
(String destinationName) Gets the destination thread.static String
getHostReport
(Host proxyHost, Host host) Gets the host report.Gets the MBean info.Gets the monitoring thread.static String
getMoverReport
(Host proxyHost) Gets the mover report.static int
getNumberOfDownloadsFor
(TransferServer server, int fileSystem) Allow getting the current number of downloads for the provided moverName and fileSystem.int
getPendingDataTransfersCount
(String destinationName) Gets the pending data transfers count.int
Gets the pool size.static TransferServer
getTransferServerName
(boolean debug, String transferGroupName, TransferServer originalMover, String moverList) Randomly select a DataMover from a list in the format ({operator} TransferGroup) mover1,mover2 ...static String
Get the name of the TransferServer which was used to retrieve the file from the source host.void
holdAllDestinations
(String userName, String status, boolean graceful) Hold all destinations.void
holdDestination
(String userName, String destinationName, String status, boolean graceful) Hold destination.void
Initialize.static boolean
isAcquisition
(DataTransfer transfer) Checks if is acquisition.static String[]
list
(TransferServer server, Host host, String source, String pattern) List.static void
mkdir
(TransferServer server, Host host, String dir) Mkdir.static void
move
(TransferServer server, Host host, String source, String target) Move.int
nextStep()
Next step.void
notifyCompletion
(DataTransfer transfer) Notify completion.void
Notify requeue.purge
(TransferServer[] transfers, DataFile dataFile) Purge.purge
(TransferServer[] transfers, Host proxyHost, DataFile dataFile) Purge.static void
purge
(TransferServer[] servers, Host proxyHost, List<ExistingStorageDirectory> directories) Purge.static boolean
put
(TransferServer[] servers, DataTransfer transfer, Host hostForSource) Puts the.static ProxySocket
put
(TransferServer server, Host host, String target, long remotePosn, long size) Puts the.replicate
(TransferServer[] serversList, DataTransfer transfer) Replicate.void
restartAllDestinations
(String userName, boolean graceful) Restart all destinations.void
restartDestination
(String userName, String comment, String destinationName, boolean graceful, boolean reset) Restart destination.static void
rmdir
(TransferServer server, Host host, String dir) Rmdir.boolean
setAttribute
(String name, Object value) Sets the attribute.void
setPoolSize
(int poolSize) Sets the pool size.void
shutdown()
Shutdown.void
shutdown
(boolean graceful) Shutdown.static long
size
(TransferServer server, Host host, String source) Size.void
updateHost
(Host host) Update host.Methods inherited from class ecmwf.common.ecaccess.MBeanScheduler
close, getMonitorName, invoke
Methods inherited from class ecmwf.common.ecaccess.ECaccessScheduler
configurableRun, deactivateMonitor, getDelay, getJammedTimeout, getLastStepTime, getMonitorManager, getNextStep, getSchedulerState, getStartDate, getStepTime, isInitialized, isJammed, isOnHold, isRunning, onHold, setDelay, setJammedTimeout, setOnhold, setTimeRanges, start, wakeup
Methods inherited from class ecmwf.common.technical.WakeupThread
isSleeping, waitFor
Methods inherited from class ecmwf.common.technical.ThreadService.ConfigurableRunnable
execute, execute, getContextClassLoader, getPriority, getThreadName, interrupt, interrupted, isAlive, isStarted, join, join, run, setContextClassLoader, setForceCookie, setInheritCookie, setPriority, setThreadNameAndCookie
-
Constructor Details
-
TransferScheduler
Instantiates a new transfer scheduler.- Parameters:
name
- the name
-
-
Method Details
-
notifyCompletion
Notify completion.- Parameters:
transfer
- the transfer
-
getPoolSize
public int getPoolSize()Gets the pool size.- Returns:
- the pool size
-
setPoolSize
public void setPoolSize(int poolSize) Sets the pool size.- Parameters:
poolSize
- the new pool size
-
notifyRequeue
public void notifyRequeue()Notify requeue. -
initialize
-
getDestinationThread
public TransferScheduler.DestinationThread getDestinationThread(String destinationName) throws MasterException Gets the destination thread.- Parameters:
destinationName
- the destination name- Returns:
- the destination thread
- Throws:
MasterException
- the master exception
-
getDestinations
-
getDestinationLastTransfer
Gets the destination last transfer.- Parameters:
destinationName
- the destination nameok
- the ok- Returns:
- the destination last transfer
-
updateHost
Update host.- Parameters:
host
- the host- Throws:
DataBaseException
- the data base exception
-
getPendingDataTransfersCount
Gets the pending data transfers count.- Parameters:
destinationName
- the destination name- Returns:
- the pending data transfers count
-
holdDestination
public void holdDestination(String userName, String destinationName, String status, boolean graceful) throws DataBaseException Hold destination.- Parameters:
userName
- the user namedestinationName
- the destination namestatus
- the statusgraceful
- the graceful- Throws:
DataBaseException
- the data base exception
-
holdAllDestinations
public void holdAllDestinations(String userName, String status, boolean graceful) throws DataBaseException Hold all destinations.- Parameters:
userName
- the user namestatus
- the statusgraceful
- the graceful- Throws:
DataBaseException
- the data base exception
-
getDestinationStatus
Gets the destination status.- Parameters:
destinationName
- the destination name- Returns:
- the destination status
- Throws:
DataBaseException
- the data base exception
-
getDestinationStatus
public String getDestinationStatus(String destinationName, String statusCode) throws DataBaseException Gets the destination status.- Parameters:
destinationName
- the destination namestatusCode
- the Status Code- Returns:
- the destination status
- Throws:
DataBaseException
- the data base exception
-
restartDestination
public void restartDestination(String userName, String comment, String destinationName, boolean graceful, boolean reset) throws DataBaseException Restart destination.- Parameters:
userName
- the user namecomment
- the commentdestinationName
- the destination namegraceful
- the gracefulreset
- the reset- Throws:
DataBaseException
- the data base exception
-
restartAllDestinations
Restart all destinations.- Parameters:
userName
- the user namegraceful
- the graceful- Throws:
DataBaseException
- the data base exception
-
getMonitoringThread
Gets the monitoring thread.- Returns:
- the monitoring thread
- Throws:
MasterException
- the master exception
-
nextStep
public int nextStep()Next step. Next step.- Specified by:
nextStep
in classECaccessScheduler
- Returns:
- the int
-
getActivity
Gets the activity. Gets the activity.- Overrides:
getActivity
in classECaccessScheduler
- Returns:
- the activity
-
getTransferServerUsedForRetrieval
Get the name of the TransferServer which was used to retrieve the file from the source host.- Parameters:
transfer
- the transfer- Returns:
- the transfer server used for retrieval
-
getTransferServerName
public static TransferServer getTransferServerName(boolean debug, String transferGroupName, TransferServer originalMover, String moverList) throws IOException Randomly select a DataMover from a list in the format ({operator} TransferGroup) mover1,mover2 ... (e.g. (== internet) ecpds-dm1,ecpds-dm2). If there is no DataMover found then return the original DataMover.- Parameters:
debug
- the debugtransferGroupName
- the transfer group nameoriginalMover
- the original movermoverList
- the mover list- Returns:
- the transfer server name
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
put
public static ProxySocket put(TransferServer server, Host host, String target, long remotePosn, long size) throws MasterException Puts the.- Parameters:
server
- the serverhost
- the hosttarget
- the targetremotePosn
- the remote posnsize
- the size- Returns:
- the proxy socket
- Throws:
MasterException
- the master exception
-
get
public static ProxySocket get(TransferServer server, Host host, String source, long remotePosn, long length, boolean removeOriginal) throws MasterException Gets the.- Parameters:
server
- the serverhost
- the hostsource
- the sourceremotePosn
- the remote posnlength
- the lengthremoveOriginal
- the remove original- Returns:
- the proxy socket
- Throws:
MasterException
- the master exception
-
get
public static ProxySocket get(DataTransfer transfer, long remotePosn, long length) throws DataBaseException, MasterException Gets a ProxySocket to download a DataTransfer.- Parameters:
transfer
- the transferremotePosn
- the remote posnlength
- the length- Returns:
- the proxy socket
- Throws:
DataBaseException
- the data base exceptionMasterException
- the master exception
-
check
Check.- Parameters:
proxySocket
- the proxy socket- Throws:
IOException
- Signals that an I/O exception has occurred.
-
size
Size.- Parameters:
server
- the serverhost
- the hostsource
- the source- Returns:
- the long
- Throws:
MasterException
- the master exception
-
list
public static String[] list(TransferServer server, Host host, String source, String pattern) throws MasterException List.- Parameters:
server
- the serverhost
- the hostsource
- the sourcepattern
- the pattern- Returns:
- the string[]
- Throws:
MasterException
- the master exception
-
del
Del.- Parameters:
server
- the serverhost
- the hostsource
- the source- Throws:
MasterException
- the master exception
-
check
Check.- Parameters:
server
- the serverticket
- the ticket- Throws:
MasterException
- the master exception
-
mkdir
Mkdir.- Parameters:
server
- the serverhost
- the hostdir
- the dir- Throws:
MasterException
- the master exception
-
rmdir
Rmdir.- Parameters:
server
- the serverhost
- the hostdir
- the dir- Throws:
MasterException
- the master exception
-
isAcquisition
Checks if is acquisition.- Parameters:
transfer
- the transfer- Returns:
- true, if is acquisition
-
move
public static void move(TransferServer server, Host host, String source, String target) throws MasterException Move.- Parameters:
server
- the serverhost
- the hostsource
- the sourcetarget
- the target- Throws:
MasterException
- the master exception
-
put
Puts the.- Parameters:
servers
- the serverstransfer
- the transferhostForSource
- the host for source- Returns:
- true, if successful
-
filter
public static TransferScheduler.FilterResult filter(TransferServer[] serversList, DataFile dataFile, boolean remove) Filter.- Parameters:
serversList
- the servers listdataFile
- the data fileremove
- the remove- Returns:
- the filter result
-
replicate
public static TransferScheduler.ReplicateResult replicate(TransferServer[] serversList, DataTransfer transfer) Replicate.- Parameters:
serversList
- the servers listtransfer
- the transfer- Returns:
- the replicate result
-
backup
public static TransferScheduler.BackupResult backup(Host hostForBackup, TransferServer[] servers, DataTransfer transfer) throws DataBaseException Backup.- Parameters:
hostForBackup
- the host for backupservers
- the serverstransfer
- the transfer- Returns:
- the backup result
- Throws:
DataBaseException
- the data base exception
-
acquisition
public static TransferScheduler.AcquisitionResult acquisition(StatusUpdate out, String destinationName, Host host, String source, String pattern, boolean synchronous) throws TransferServerProvider.TransferServerException, DataBaseException, IOException Version 1 is getting the list as an array of String and version 2 is getting the list as an InputStream.- Parameters:
out
- the outdestinationName
- the destination namehost
- the hostsource
- the sourcepattern
- the patternsynchronous
- the synchronous- Returns:
- the acquisition result
- Throws:
TransferServerProvider.TransferServerException
- the transfer server exceptionDataBaseException
- the data base exceptionIOException
- Signals that an I/O exception has occurred.
-
execution
public static TransferScheduler.ExecutionResult execution(StatusUpdate out, String destinationName, Host host, String script) throws TransferServerProvider.TransferServerException, DataBaseException, IOException Executing script against data mover (this is because the script might open a connection to a remote site to get the list of files to retrieve).- Parameters:
out
- the outdestinationName
- the destination namehost
- the hostscript
- the script- Returns:
- the execution result
- Throws:
TransferServerProvider.TransferServerException
- the transfer server exceptionDataBaseException
- the data base exceptionIOException
- Signals that an I/O exception has occurred.
-
getNumberOfDownloadsFor
Allow getting the current number of downloads for the provided moverName and fileSystem.- Parameters:
server
- the serverfileSystem
- the file system- Returns:
- the number of downloads for
-
download
public static TransferScheduler.DownloadResult download(DataTransfer transfer, Host hostForSource, List<DataTransfer> relatedTransfers) throws TransferServerProvider.TransferServerException, DataBaseException Download.- Parameters:
transfer
- the transferhostForSource
- the host for sourcerelatedTransfers
- the related transfers- Returns:
- the download result
- Throws:
TransferServerProvider.TransferServerException
- the transfer server exceptionDataBaseException
- the data base exception
-
purge
Purge.- Parameters:
transfers
- the transfersdataFile
- the data file- Returns:
- the purge result
-
purge
public static TransferScheduler.PurgeResult purge(TransferServer[] transfers, Host proxyHost, DataFile dataFile) Purge.- Parameters:
transfers
- the transfersproxyHost
- the proxy hostdataFile
- the data file- Returns:
- the purge result
-
purge
public static void purge(TransferServer[] servers, Host proxyHost, List<ExistingStorageDirectory> directories) Purge.- Parameters:
servers
- the serversproxyHost
- the proxy hostdirectories
- the directories
-
getMoverReport
Gets the mover report.- Parameters:
proxyHost
- the proxy host- Returns:
- the mover report
- Throws:
DataBaseException
- the data base exceptionIOException
- Signals that an I/O exception has occurred.
-
getHostReport
Gets the host report.- Parameters:
proxyHost
- the proxy hosthost
- the host- Returns:
- the host report
- Throws:
DataBaseException
- the data base exceptionIOException
- Signals that an I/O exception has occurred.
-
shutdown
-
shutdown
public void shutdown(boolean graceful) Shutdown.- Parameters:
graceful
- the graceful
-
getMBeanInfo
Gets the MBean info. Gets the MBean info. Gets the MBean info.- Specified by:
getMBeanInfo
in interfaceMBeanService
- Overrides:
getMBeanInfo
in classMBeanScheduler
- Returns:
- the MBean info
-
getAttribute
Gets the attribute. Gets the attribute. Gets the attribute.- Specified by:
getAttribute
in interfaceMBeanService
- Overrides:
getAttribute
in classMBeanScheduler
- Parameters:
attributeName
- the attribute name- Returns:
- the attribute
- Throws:
AttributeNotFoundException
- the attribute not found exceptionMBeanException
- the MBean exception
-
setAttribute
public boolean setAttribute(String name, Object value) throws InvalidAttributeValueException, MBeanException Sets the attribute. Sets the attribute. Sets the attribute.- Specified by:
setAttribute
in interfaceMBeanService
- Overrides:
setAttribute
in classMBeanScheduler
- Parameters:
name
- the namevalue
- the value- Returns:
- true, if successful
- Throws:
InvalidAttributeValueException
- the invalid attribute value exceptionMBeanException
- the MBean exception
-