class ComputationalServiceImpl implements ComputationalService {

	@BudgetLimited
	@Override
	public boolean createSparkCluster(UserInfo userInfo, SparkStandaloneClusterCreateForm form, @Project String project) {

		final ProjectDTO projectDTO = projectService.get(project);
		final UserInstanceDTO instance =
				exploratoryDAO.fetchExploratoryFields(userInfo.getName(), project, form.getNotebookName());
		final SparkStandaloneClusterResource compResource = createInitialComputationalResource(form);
		compResource.setTags(tagService.getResourceTags(userInfo, instance.getEndpoint(), project,
				form.getCustomTag()));
		if (computationalDAO.addComputational(userInfo.getName(), form.getNotebookName(), project, compResource)) {
			try {
				EndpointDTO endpointDTO = endpointService.get(instance.getEndpoint());
				ComputationalBase<?> dto = requestBuilder.newComputationalCreate(userInfo, projectDTO, instance, form, endpointDTO);

				String uuid =
						provisioningService.post(endpointDTO.getUrl() + ComputationalAPI.COMPUTATIONAL_CREATE_SPARK,
								userInfo.getAccessToken(), dto, String.class);
				requestId.put(userInfo.getName(), uuid);
				return true;
			} catch (RuntimeException e) {
				try {
					updateComputationalStatus(userInfo.getName(), project, form.getNotebookName(), form.getName(), FAILED);
				} catch (DlabException d) {
					log.error(COULD_NOT_UPDATE_THE_STATUS_MSG_FORMAT, form.getName(), userInfo.getName(), d);
				}
				throw e;
			}
		} else {
			log.debug("Computational with name {} is already existing for user {}", form.getName(),
					userInfo.getName());
			return false;
		}
	}

	@Inject public  ComputationalServiceImpl(ProjectService projectService, ExploratoryDAO exploratoryDAO, ComputationalDAO computationalDAO,
									@Named(ServiceConsts.PROVISIONING_SERVICE_NAME) RESTService provisioningService,
									RequestBuilder requestBuilder, RequestId requestId, TagService tagService,
									EndpointService endpointService, InfrastructureTemplateService templateService);

}