Introduction
This is the third in a series of articles describing how to get started with using the the YADE Client via its Command Line Interface and covers:
- Polling a Source Directory
YADE Tutorials List
YADE Client Command Line Interface
- Getting Started and Downloading files
- Simple File Selection
- More Advanced File Selection
- Checking files for completeness
- Public / Private Key Authentication
- Transfer via a Jump Host / DMZ
YADE Background Service
Prerequisites
See the Using the tutorials with the YADE Client Command Line Interface article for guidelines to setting up and running the tutorial examples.
Instructions for installing, configuring and using the XML Editor can be found in the XML Editor series of articles.
Download file
The configuration described in this tutorial can be downloaded and then directly opened in the XML Editor using the following link:
Polling a source directory for a minimum number of files
YADE can poll a source directory at regular intervals until it finds a file name match or until a specified length of time has elapsed. If it finds a file name match with one or more files it will then transfer the matching file(s) and then stop polling.
YADE can also delay transfer until a minimum number of file name matches has been found.
YADE will transfer all those files it has found at the end of the polling interval if the minimum number of matches has not been reached.
Configuration structure
ProtocolFragment
The ftp_demo_sos-berlin ProtocolFragment used in the first tutorial in this series will be reused.
Profile
The example presented in this tutorial uses a Profile based on the ftp_server_to_local Profile described in the first tutorial in this series.
The new Profile, has been given the profile_id = ftp_server_to_local_poll and the following changes have been made:
FileSpec
The value of the FileSpec element was changed to ^test_.\.txt$
. Five files will be found in the transfer source directory.
Polling Elements
The Polling parent element is added as a child of the SourceFileOptions element. In the example profile shown in the XML Editor screenshot below the function of the three polling parameters should be self-explanatory but the following should be noted:
PollInterval - is specified in seconds (only integer values)
PollTimeout - is specified in minutes (only integer values)
MinFiles - optional - can only be used together with PollTimeout
XML Editor Configuration
The Profile Code
The following code boxes can be opened to show the Profile and ProtocolFragments used in this example in XML and in settings.ini
formats.
Running the Profile
This profile is called on Windows systems using one of the following commands, depending on the YADE version being used:
jade.cmd -settings="%USERPROFILE%\jade_demo\sos-berlin_demo_2_local_poll.ini" -profile="ftp_server_2_local_poll_minfiles"
jade.cmd -settings="%USERPROFILE%\jade_demo\sos-berlin_demo_2_local_poll.xml" -profile="ftp_server_2_local_poll_minfiles"
On Unix systems the profile is called using one of the following commands, depending on the YADE version being used:
./jade.sh -settings="${HOME}/jade_demo/sos-berlin_demo_2_local_poll.ini" -profile="ftp_server_2_local_poll_minfiles"
./jade.sh -settings="${HOME}/jade_demo/sos-berlin_demo_2_local_poll.xml" -profile="ftp_server_2_local_poll_minfiles"
Example behavior with MinFiles less than the number of files found
- YADE runs the first polling operation immediately and will transfer all the files found - in this case the 5 test_*.txt files - as more than the minimum number of files has been found. Polling will then be stopped.
- If no files were to be found then the YADE engine would throw an error as long as DisableErrorOnNoFilesFound = true has not been set.
Example behavior with MinFiles more than the number of files found
Change the MinFiles parameter in the XML Editor to 6, save the configuration and rerun the example.
- YADE will find the five test_*.txt files when it polls but will not transfer the files as the minimum number of 6 has not been reached.
- YADE will repeat polling until the time set in the PollTimeout parameter (with the example configuration after 1 minute 20 secs) has expired.
- Note that all the files that have been found will be transferred once the timeout has been reached.