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: */package org.griphyn.cPlanner.transfer;
015:
016: import org.griphyn.cPlanner.classes.SubInfo;
017: import org.griphyn.cPlanner.classes.PlannerOptions;
018:
019: import org.griphyn.cPlanner.engine.ReplicaCatalogBridge;
020:
021: import org.griphyn.cPlanner.common.PegasusProperties;
022:
023: import java.util.Collection;
024:
025: import java.io.IOException;
026:
027: import java.lang.reflect.InvocationTargetException;
028:
029: /**
030: * The refiner interface, that determines the functions that need to be
031: * implemented to add various types of transfer nodes to the workflow.
032: *
033: * @author Karan Vahi
034: * @author Gaurang Mehta
035: *
036: * @version $Revision: 243 $
037: */
038: public interface Refiner extends org.griphyn.cPlanner.engine.Refiner {//need to extend it for the PASOA integration
039:
040: /**
041: * The prefix for the jobs which are added to transfer the files to a job's
042: * execution pool from the location returned from the replica mechanism.
043: * the new job's name is FROM_RC_PREFIX + nameofjob + _+ counter.
044: */
045: public static final String STAGE_IN_PREFIX = "rc_tx_";
046:
047: /**
048: * The prefix for the jobs which are added to transfer the files generated by
049: * a job on an execution pool to the output pool. The new job's name is
050: * TO_RC_PREFIX + nameofjob + _+ counter.
051: *
052: */
053: public static final String STAGE_OUT_PREFIX = "new_rc_tx_";
054:
055: /**
056: * The prefix for the jobs which are added to transfer the files generated by
057: * the parents of a job to the jobs execution pool. The new job's name is
058: * INTER_POOL_PREFIX + nameofjob + _+ counter.
059: */
060: public static final String INTER_POOL_PREFIX = "inter_tx_";
061:
062: /**
063: * The prefix for the jobs which register the newly materialized files in the
064: * Replica Catalog. The job's name should be RC_REGISTER_PREFIX + nameofjob,
065: * where nameofjob is the job that generates these materialized files.
066: */
067: public static final String REGISTER_PREFIX = "new_rc_register_";
068:
069: /**
070: * Loads the appropriate implementations that is required by this refinement
071: * strategy for different types of transfer jobs. It calls to the factory
072: * method to load the appropriate Implementor.
073: *
074: * Loads the implementing class corresponding to the mode specified by the user
075: * at runtime in the properties file. The properties object passed should not
076: * be null.
077: *
078: * @param properties the <code>PegasusProperties</code> object containing all
079: * the properties required by Pegasus.
080: * @param options the options passed to the planner at runtime.
081: *
082: */
083: public void loadImplementations(PegasusProperties properties,
084: PlannerOptions options) throws ClassNotFoundException,
085: IOException, NoSuchMethodException, InstantiationException,
086: IllegalAccessException, InvocationTargetException,
087: ClassCastException;
088:
089: /**
090: * Adds the inter pool transfer nodes that are required for transferring
091: * the output files of the parents to the jobs execution site.
092: *
093: * @param job <code>SubInfo</code> object corresponding to the node to
094: * which the files are to be transferred to.
095: * @param files Collection of <code>FileTransfer</code> objects containing the
096: * information about source and destURL's.
097: */
098: public void addInterSiteTXNodes(SubInfo job, Collection files);
099:
100: /**
101: * Adds the stageout transfer nodes, that stage data to an output site
102: * specified by the user.
103: *
104: * @param job <code>SubInfo</code> object corresponding to the node to
105: * which the files are to be transferred to.
106: * @param files Collection of <code>FileTransfer</code> objects containing the
107: * information about source and destURL's.
108: * @param rcb bridge to the Replica Catalog. Used for creating registration
109: * nodes in the workflow.
110: *
111: */
112: public void addStageOutXFERNodes(SubInfo job, Collection files,
113: ReplicaCatalogBridge rcb);
114:
115: /**
116: * Adds the stageout transfer nodes, that stage data to an output site
117: * specified by the user. It also adds the registration nodes to register
118: * the data in the replica catalog if required.
119: *
120: * @param job <code>SubInfo</code> object corresponding to the node to
121: * which the files are to be transferred to.
122: * @param files Collection of <code>FileTransfer</code> objects containing the
123: * information about source and destURL's.
124: * @param rcb bridge to the Replica Catalog. Used for creating registration
125: * nodes in the workflow.
126: *
127: * @param deletedLeaf to specify whether the node is being added for
128: * a deleted node by the reduction engine or not.
129: * default: false
130: */
131: public abstract void addStageOutXFERNodes(SubInfo job,
132: Collection files, ReplicaCatalogBridge rcb,
133: boolean deletedLeaf);
134:
135: /**
136: * Adds the stage in transfer nodes which transfer the input files for a job,
137: * from the location returned from the replica catalog to the job's execution
138: * pool.
139: *
140: * @param job <code>SubInfo</code> object corresponding to the node to
141: * which the files are to be transferred to.
142: * @param files Collection of <code>FileTransfer</code> objects containing the
143: * information about source and destURL's.
144: */
145: public void addStageInXFERNodes(SubInfo job, Collection files);
146:
147: /**
148: * Signals that the traversal of the workflow is done. This would allow
149: * the transfer mechanisms to clean up any state that they might be keeping
150: * that needs to be explicitly freed.
151: */
152: public void done();
153:
154: /**
155: * Returns whether a Site is third party enabled or not.
156: *
157: * @param site the name of the site.
158: * @param type the type of transfer job for which the URL is being constructed.
159: * Should be one of the following:
160: * stage-in
161: * stage-out
162: * inter-pool transfer
163: *
164: * @return true pool is third party enabled
165: * false pool is not third party enabled.
166: *
167: * @see SubInfo#STAGE_IN_JOB
168: * @see SubInfo#INTER_POOL_JOB
169: * @see SubInfo#STAGE_OUT_JOB
170: */
171: public boolean isSiteThirdParty(String site, int type);
172:
173: /**
174: * Returns whether the third party transfers for a particular site are to
175: * be run on the remote site or the submit host.
176: *
177: * @param site the name of the site.
178: * @param type the type of transfer job for which the URL is being constructed.
179: * Should be one of the following:
180: * stage-in
181: * stage-out
182: * inter-pool transfer
183: *
184: * @return true if the transfers are to be run on remote site, else false.
185: *
186: * @see SubInfo#STAGE_IN_JOB
187: * @see SubInfo#INTER_POOL_JOB
188: * @see SubInfo#STAGE_OUT_JOB
189: */
190: public boolean runTPTOnRemoteSite(String site, int type);
191:
192: /**
193: * Add a new job to the workflow being refined.
194: *
195: * @param job the job to be added.
196: */
197: public void addJob(SubInfo job);
198:
199: /**
200: * Adds a new relation to the workflow being refiner.
201: *
202: * @param parent the jobname of the parent node of the edge.
203: * @param child the jobname of the child node of the edge.
204: */
205: public void addRelation(String parent, String child);
206:
207: /**
208: * Adds a new relation to the workflow. In the case when the parent is a
209: * transfer job that is added, the parentNew should be set only the first
210: * time a relation is added. For subsequent compute jobs that maybe
211: * dependant on this, it needs to be set to false.
212: *
213: * @param parent the jobname of the parent node of the edge.
214: * @param child the jobname of the child node of the edge.
215: * @param pool the execution pool where the transfer node is to be run.
216: * @param parentNew the parent node being added, is the new transfer job
217: * and is being called for the first time.
218: */
219: public void addRelation(String parent, String child, String pool,
220: boolean parentNew);
221:
222: /**
223: * Returns a textual description of the transfer mode.
224: *
225: * @return a short textual description
226: */
227: public String getDescription();
228:
229: }
|