public static Integer fromShortStringToSeconds(String arg) throws Exception {
		if (StringUtils.isBlank(arg)) {
			throw new Exception("No walltime string provided.");
		}
		int ivalue = 0;
		try {
			ivalue = Integer.parseInt(arg);
		} catch (final NumberFormatException ex) {
			final Pattern date = Pattern
					.compile("([0-9]+[dD])?([0-9]+[hH])?([0-9]+[mM])?");
			final Matcher m = date.matcher(arg);
			if (!m.matches()) {
				throw new Exception("'" + arg + "' not a valid walltime format");
			}
			String days = m.group(1);
			String hours = m.group(2);
			String minutes = m.group(3);

			days = (days == null) ? "0" : days.toLowerCase().replace("d", "");
			hours = (hours == null) ? "0" : hours.toLowerCase()
					.replace("h", "");
			minutes = (minutes == null) ? "0" : minutes.toLowerCase().replace(
					"m", "");

			try {
				ivalue = (Integer.parseInt(days) * 1440)
						+ (Integer.parseInt(hours) * 60)
						+ Integer.parseInt(minutes);

				ivalue = ivalue * 60;

			} catch (final NumberFormatException ex2) {
				throw new Exception("'" + arg + "' not a valid walltime format");
			}

		}

		if (ivalue < 0) {
			throw new Exception("'" + arg + "'must be positive");
		}
		return ivalue;
	}