001: /*
002: * This file or a portion of this file is licensed under the terms of
003: * the Globus Toolkit Public License, found in file GTPL, or at
004: * http://www.globus.org/toolkit/download/license.html. This notice must
005: * appear in redistributions of this file, with or without modification.
006: *
007: * Redistributions of this Software, with or without modification, must
008: * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
009: * some other similar material which is provided with the Software (if
010: * any).
011: *
012: * Copyright 1999-2004 University of Chicago and The University of
013: * Southern California. All rights reserved.
014: */
015: package org.griphyn.cPlanner.transfer;
016:
017: import org.griphyn.cPlanner.classes.SubInfo;
018: import org.griphyn.cPlanner.classes.TransferJob;
019:
020: import org.griphyn.cPlanner.common.PegasusProperties;
021:
022: import org.griphyn.common.catalog.TransformationCatalogEntry;
023:
024: import java.util.Collection;
025:
026: /**
027: * The interface defines the functions that a particular Transfer Implementation
028: * should implement. The functions deal with the creation of a TransferJob that
029: * can transfer files using the transfer tool to which it refers to.
030: *
031: * @author Karan Vahi
032: * @author Gaurang Mehta
033: * @version $Revision: 192 $
034: */
035: public interface Implementation {
036:
037: /**
038: * The version number associated with this API of Code Generator.
039: */
040: public static final String VERSION = "1.3";
041:
042: /**
043: * The universe that applies for the transfer jobs. Used for querying to the
044: * Site Catalog.
045: */
046: public static final String TRANSFER_UNIVERSE = "transfer";
047:
048: /**
049: * Sets the callback to the refiner, that has loaded this implementation.
050: *
051: * @param refiner the transfer refiner that loaded the implementation.
052: */
053: public void setRefiner(Refiner refiner);
054:
055: /**
056: * This constructs the SubInfo object for the transfer node. The transfer is
057: * supposed to occur at job execution site. It should lead to the creation
058: * of the setup chmod jobs to the workflow, that appear as parents to compute
059: * jobs in case the transfer implementation does not preserve the X bit
060: * on the file being transferred. This is required for staging of executables
061: * as part of the workflow.
062: *
063: * @param job the SubInfo object for the job, in relation to which
064: * the transfer node is being added. Either the transfer
065: * node can be transferring this jobs input files to
066: * the execution pool, or transferring this job's output
067: * files to the output pool.
068: * @param files collection of <code>FileTransfer</code> objects
069: * representing the data files and staged executables to be
070: * transferred.
071: * @param execFiles subset collection of the files parameter, that identifies
072: * the executable files that are being transferred.
073: * @param txJobName the name of transfer node.
074: * @param jobClass the job Class for the newly added job. Can be one of the
075: * following:
076: * stage-in
077: * stage-out
078: * inter-pool transfer
079: *
080: * @return the created TransferJob.
081: */
082: public TransferJob createTransferJob(SubInfo job, Collection files,
083: Collection execFiles, String txJobName, int jobClass);
084:
085: /**
086: * Returns a boolean indicating whether the transfer protocol being used by
087: * the implementation preserves the X Bit or not while staging. If it does
088: * not, then it should extend the Abstract implementation of this interface,
089: * that allows for adding of a setup job after the stagein job that changes
090: * the X Bit.
091: */
092: public boolean doesPreserveXBit();
093:
094: /**
095: * Adds the dirmanager job to the workflow, that do a chmod on the files
096: * being staged.
097: *
098: * @param computeJob the computeJob for which the files are
099: * being staged.
100: * @param txJobName the name of the transfer job that is staging the files.
101: * @param execFiles the executable files that are being staged.
102: * @param transferClass the class of transfer job
103: *
104: * @return boolean indicating whether any XBitJobs were succesfully added or
105: * not.
106: */
107: public boolean addSetXBitJobs(SubInfo computeJob, String txJobName,
108: Collection execFiles, int transferClass);
109:
110: /**
111: * Adds the dirmanager job to the workflow, that do a chmod on the files
112: * being staged.
113: *
114: * @param computeJob the computeJob for which the files are
115: * being staged.
116: * @param txJobName the name of the transfer job that is staging the files.
117: * @param execFiles the executable files that are being staged.
118: * @param transferClass the class of transfer job
119: * @param xbitIndex index to be used for creating the name of XBitJob.
120: *
121: * @return boolean indicating whether any XBitJobs were succesfully added or
122: * not.
123: */
124: public boolean addSetXBitJobs(SubInfo computeJob, String txJobName,
125: Collection execFiles, int transferClass, int xbitIndex);
126:
127: /**
128: * Adds the dirmanager job to the workflow, that do a chmod on the executable
129: * files that are being staged. It should be empty for the implementations
130: * that preserve the X bit while staging files.
131: *
132: * @param computeJobName the name pf the computeJob for which the files are
133: * being staged.
134: * @param txJobName the name of the transfer job that is staging the files.
135: * @param execFiles the executable files that are being staged.
136: * @param transferClass the class of transfer job
137: *
138: * @return boolean indicating whether any XBitJobs were succesfully added or
139: * not.
140: */
141: // public boolean addSetXBitJobs(String computeJobName,
142: // String txJobName,
143: // Collection execFiles,
144: // int transferClass);
145:
146: /**
147: * Generates the name of the setXBitJob , that is unique for the given
148: * workflow. If the implementation preserve the X bit, then it should
149: * return null.
150: *
151: * @param name the name of the compute job for which the executable is
152: * being staged.
153: * @param counter the index for the setXBit job.
154: *
155: * @return the name of the setXBitJob, null in case the implementation
156: * preserves the XBit.
157: */
158: public String getSetXBitJobName(String name, int counter);
159:
160: /**
161: * Retrieves the transformation catalog entry for the executable that is
162: * being used to transfer the files in the implementation.
163: *
164: * @param siteHandle the handle of the site where the transformation is
165: * to be searched.
166: *
167: * @return the transformation catalog entry if found, else null.
168: */
169: public TransformationCatalogEntry getTransformationCatalogEntry(
170: String siteHandle);
171:
172: /**
173: * Return a boolean indicating whether the transfers to be done always in
174: * a third party transfer mode. A value of false, results in the
175: * direct or peer to peer transfers being done.
176: * <p>
177: * A value of false does not preclude third party transfers. They still can
178: * be done, by setting the property "pegasus.transfer.*.thirdparty.sites".
179: *
180: * @return boolean indicating whether to always use third party transfers
181: * or not.
182: *
183: * @see PegasusProperties#getThirdPartySites(String)
184: */
185: public boolean useThirdPartyTransferAlways();
186:
187: /**
188: * Applies priorities to the transfer jobs if a priority is specified
189: * in the properties file.
190: *
191: * @param job the transfer job .
192: */
193: public void applyPriority(TransferJob job);
194:
195: /**
196: * Determines if there is a need to transfer proxy for the transfer
197: * job or not. If there is a need to transfer proxy, then the job is
198: * modified to create the correct condor commands to transfer the proxy.
199: * Proxy is usually transferred if the VDS profile TRANSFER_PROXY is set,
200: * or the job is being run in the condor vanilla universe. The proxy is
201: * transferred from the submit host (i.e site local). The location is
202: * determined from the value of the X509_USER_PROXY profile key associated
203: * in the env namespace.
204: *
205: * @param job the transfer job .
206: *
207: * @return boolean true job was modified to transfer the proxy, else
208: * false when job is not modified.
209: */
210: public boolean checkAndTransferProxy(TransferJob job);
211:
212: /**
213: * Returns a textual description of the transfer implementation.
214: *
215: * @return a short textual description
216: */
217: public String getDescription();
218:
219: }
|