PageRenderTime 64ms CodeModel.GetById 39ms RepoModel.GetById 0ms app.codeStats 0ms

/src/Extensions/org/objectweb/proactive/extensions/gcmdeployment/GCMDeployment/group/GroupCCS.java

https://bitbucket.org/lp/programming-multiactivities
Java | 148 lines | 85 code | 26 blank | 37 comment | 10 complexity | ef0abbcefeb03f17de8b78da4c373416 MD5 | raw file
  1. /*
  2. * ################################################################
  3. *
  4. * ProActive Parallel Suite(TM): The Java(TM) library for
  5. * Parallel, Distributed, Multi-Core Computing for
  6. * Enterprise Grids & Clouds
  7. *
  8. * Copyright (C) 1997-2012 INRIA/University of
  9. * Nice-Sophia Antipolis/ActiveEon
  10. * Contact: proactive@ow2.org or contact@activeeon.com
  11. *
  12. * This library is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU Affero General Public License
  14. * as published by the Free Software Foundation; version 3 of
  15. * the License.
  16. *
  17. * This library is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License
  23. * along with this library; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  25. * USA
  26. *
  27. * If needed, contact us to obtain a release under GPL Version 2 or 3
  28. * or a different license than the AGPL.
  29. *
  30. * Initial developer(s): The ProActive Team
  31. * http://proactive.inria.fr/team_members.htm
  32. * Contributor(s):
  33. *
  34. * ################################################################
  35. * $$PROACTIVE_INITIAL_DEV$$
  36. */
  37. package org.objectweb.proactive.extensions.gcmdeployment.GCMDeployment.group;
  38. import java.util.ArrayList;
  39. import java.util.List;
  40. import org.objectweb.proactive.extensions.gcmdeployment.PathElement;
  41. import org.objectweb.proactive.extensions.gcmdeployment.GCMApplication.GCMApplicationInternal;
  42. import org.objectweb.proactive.extensions.gcmdeployment.GCMApplication.commandbuilder.CommandBuilder;
  43. import org.objectweb.proactive.extensions.gcmdeployment.GCMApplication.commandbuilder.CommandBuilderProActive;
  44. public class GroupCCS extends AbstractGroup {
  45. private String runTime = null;
  46. private int cpus = 0;
  47. private String stdout = null;
  48. private String stderr = null;
  49. private String preCommand = null;
  50. private PathElement scriptLocation = new PathElement("dist\\scripts\\gcmdeployment\\ccs.vbs",
  51. PathElement.PathBase.PROACTIVE);
  52. @Override
  53. public List<String> buildCommands(CommandBuilder commandBuilder, GCMApplicationInternal gcma) {
  54. StringBuilder command = new StringBuilder();
  55. command.append("cscript");
  56. command.append(" ");
  57. command.append(scriptLocation.getFullPath(hostInfo, commandBuilder));
  58. command.append(" ");
  59. command.append("/tasks:" + cpus);
  60. command.append(" ");
  61. String classpath = ((CommandBuilderProActive) commandBuilder).getClasspath(hostInfo);
  62. command.append(" ");
  63. command.append("/classpath:\"" + classpath + "\"");
  64. command.append(" ");
  65. String cbCommand = ((CommandBuilderProActive) commandBuilder).buildCommand(hostInfo, gcma, false);
  66. //cbCommand = Helpers.escapeWindowsCommand(cbCommand);
  67. cbCommand += " -c 1 ";
  68. command.append(" ");
  69. if (preCommand != null && !"".equals(preCommand)) {
  70. command.append("/application:\"" + preCommand + " & " + cbCommand + "\"");
  71. } else {
  72. command.append("/application:\"" + cbCommand + "\"");
  73. }
  74. command.append(" ");
  75. if (getStdout() != null) {
  76. command.append("/stdout:" + getStdout());
  77. command.append(" ");
  78. }
  79. if (getStderr() != null) {
  80. command.append("/stderr:" + getStderr());
  81. command.append(" ");
  82. }
  83. if (getRunTime() != null) {
  84. command.append("/runtime:" + getRunTime());
  85. command.append(" ");
  86. }
  87. List<String> ret = new ArrayList<String>();
  88. ret.add(command.toString());
  89. return ret;
  90. }
  91. @Override
  92. public List<String> internalBuildCommands(CommandBuilder commandBuilder) {
  93. return null;
  94. }
  95. public String getRunTime() {
  96. return runTime;
  97. }
  98. public void setRunTime(String runTime) {
  99. this.runTime = runTime;
  100. }
  101. public int getCpus() {
  102. return cpus;
  103. }
  104. public void setCpus(int cpus) {
  105. this.cpus = cpus;
  106. }
  107. public String getStdout() {
  108. return stdout;
  109. }
  110. public void setStdout(String stdout) {
  111. this.stdout = stdout;
  112. }
  113. public String getStderr() {
  114. return stderr;
  115. }
  116. public void setStderr(String stderr) {
  117. this.stderr = stderr;
  118. }
  119. public void setPreCommand(String preCmd) {
  120. this.preCommand = preCmd;
  121. }
  122. }