Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing .env files #277

Open
RoanKanninga opened this issue Oct 17, 2017 · 3 comments
Open

removing .env files #277

RoanKanninga opened this issue Oct 17, 2017 · 3 comments

Comments

@RoanKanninga
Copy link
Member

Removing out of
generators/impl/TaskGenerator.java

// source its environment
						scriptBuilder.append(Parameters.SOURCE_COMMAND).append(" ")
								.append(Parameters.ENVIRONMENT_DIR_VARIABLE).append(File.separator).append(prevJobName)
								.append(Parameters.ENVIRONMENT_EXTENSION).append("\n");
scriptBuilder.append("\n\n# Connect parameters to environment\n");
// append footer that appends the task's parameters to
			// environment of this task
			String myEnvironmentFile = Parameters.ENVIRONMENT_DIR_VARIABLE + File.separator + task.getName()
					+ Parameters.ENVIRONMENT_EXTENSION;
			scriptBuilder.append("\n#\n## End of your protocol template\n#\n");
			scriptBuilder.append("\n# Save output in environment file: '" + myEnvironmentFile
					+ "' with the output vars of this step\n");

			Iterator<Output> itOutput = step.getProtocol().getOutputs().iterator();
			while (itOutput.hasNext())
			{
				String parameterName = itOutput.next().getName();
				if (dataEntityValues.containsKey(parameterName))
				{
					// If parameter not set at runtime then ERROR
					String line = "if [[ -z \"$" + parameterName + "\" ]]; then echo \"In step '" + step.getName()
							+ "', parameter '" + parameterName + "' has no value! Please assign a value to parameter '"
							+ parameterName + "'." + "\" >&2; exit 1; fi\n";

					// Else set parameters at right indexes.
					// Explanation: if param file is collapsed in this
					// template, then we should not output a single
					// value but a list of values because next step may
					// be run in uncollapsed fashion

					List<String> rowIndex = dataEntity.getList(Parameters.ID_COLUMN);
					for (int i = 0; i < rowIndex.size(); i++)
					{
						Object rowIndexObject = rowIndex.get(i);
						String rowIndexString = rowIndexObject.toString();
						line += "echo \"" + step.getName() + Parameters.STEP_PARAM_SEP_SCRIPT + parameterName + "["
								+ rowIndexString + "]=\\\"${" + parameterName + "[" + i + "]}\\\"\" >> "
								+ myEnvironmentFile + "\n";
					}

					scriptBuilder.append(line);
				}

			}
			scriptBuilder.append("\necho \"\" >> " + myEnvironmentFile + "\nchmod 755 " + myEnvironmentFile + "\n");```
@pneerincx
Copy link
Member

Why disabling the creation of .env files. This would kill the feature to pass dynamic values computed at runtime of the script from one analysis step to the next. I would prefer a fix to make sure the .env files are created only when necessarry (and actually used) and with the correct permissions.

@freerkvandijk
Copy link
Member

freerkvandijk commented Oct 17, 2017 via email

@RoanKanninga
Copy link
Member Author

Fine by me, but you can already pass dynamic values from the generatedscript as a parameter via the -o argument in compute. Where do you want to set other dynamic values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants