mesosphere.marathon.client.MarathonException Java Examples
The following examples show how to use
mesosphere.marathon.client.MarathonException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MarathonBasedService.java From pravega with Apache License 2.0 | 6 votes |
@Override public boolean isRunning() { try { GetAppResponse app = marathonClient.getApp(this.id); log.debug("App Details: {}", app); //app is not running until the desired instance count is equal to the number of task/docker containers // and the state of application is healthy. if ((app.getApp().getTasksRunning().intValue() == app.getApp().getInstances().intValue()) && app.getApp().getTasksRunning().intValue() == app.getApp().getTasksHealthy().intValue()) { log.info("App {} is running", this.id); return true; } else { log.info("App {} is not running", this.id); return false; } } catch (MarathonException ex) { if (ex.getStatus() == NOT_FOUND.code()) { log.info("App is not running : {}", this.id); return false; } throw new TestFrameworkException(RequestFailed, "Marathon Exception while fetching service details", ex); } }
Example #2
Source File: MultiControllerTest.java From pravega with Apache License 2.0 | 6 votes |
@Environment public static void initialize() throws MarathonException, ExecutionException { URI zkUris = startZookeeperInstance(); startBookkeeperInstances(zkUris); URI controllerUri = ensureControllerRunning(zkUris); log.info("Controller is currently running at {}", controllerUri); Service controllerService = Utils.createPravegaControllerService(zkUris); // With Kvs we need segment stores to be running. ensureSegmentStoreRunning(zkUris, controllerUri); // scale to two controller instances. Futures.getAndHandleExceptions(controllerService.scaleService(2), ExecutionException::new); List<URI> conUris = controllerService.getServiceDetails(); log.debug("Pravega Controller service details: {}", conUris); }
Example #3
Source File: PravegaSegmentStoreTest.java From pravega with Apache License 2.0 | 6 votes |
/** * This is used to setup the various services required by the system test framework. * * @throws MarathonException if error in setup */ @Environment public static void initialize() throws MarathonException { Service zk = Utils.createZookeeperService(); if (!zk.isRunning()) { zk.start(true); } Service bk = Utils.createBookkeeperService(zk.getServiceDetails().get(0)); if (!bk.isRunning()) { bk.start(true); } Service con = Utils.createPravegaControllerService(zk.getServiceDetails().get(0)); if (!con.isRunning()) { con.start(true); } Service seg = Utils.createPravegaSegmentStoreService(zk.getServiceDetails().get(0), con.getServiceDetails().get(0)); if (!seg.isRunning()) { seg.start(true); } }
Example #4
Source File: ZookeeperService.java From pravega with Apache License 2.0 | 6 votes |
@Override public void start(final boolean wait) { deleteApp("/pravega/exhibitor"); log.info("Starting Zookeeper Service: {}", getID()); try { marathonClient.createApp(createZookeeperApp()); if (wait) { waitUntilServiceRunning().get(10, TimeUnit.MINUTES); } } catch (MarathonException e) { handleMarathonException(e); } catch (InterruptedException | ExecutionException | TimeoutException ex) { throw new TestFrameworkException(InternalError, "Exception while " + "starting Zookeeper Service", ex); } }
Example #5
Source File: BookkeeperService.java From pravega with Apache License 2.0 | 6 votes |
@Override public void start(final boolean wait) { deleteApp("/pravega/bookkeeper"); log.info("Starting Bookkeeper Service: {}", getID()); try { marathonClient.createApp(createBookieApp()); if (wait) { waitUntilServiceRunning().get(5, TimeUnit.MINUTES); } } catch (MarathonException e) { handleMarathonException(e); } catch (InterruptedException | ExecutionException | TimeoutException ex) { throw new TestFrameworkException(InternalError, "Exception while " + "starting Bookkeeper Service", ex); } }
Example #6
Source File: MarathonBasedService.java From pravega with Apache License 2.0 | 6 votes |
@Override public CompletableFuture<Void> scaleService(final int instanceCount) { Preconditions.checkArgument(instanceCount >= 0, "negative value: %s", instanceCount); try { App updatedConfig = new App(); updatedConfig.setInstances(instanceCount); marathonClient.updateApp(getID(), updatedConfig, true); return waitUntilServiceRunning(); // wait until scale operation is complete. } catch (MarathonException ex) { if (ex.getStatus() == CONFLICT.code()) { log.error("Scaling operation failed as the application is locked by an ongoing deployment", ex); throw new TestFrameworkException(RequestFailed, "Scaling operation failed", ex); } handleMarathonException(ex); } return null; }
Example #7
Source File: PravegaControllerService.java From pravega with Apache License 2.0 | 6 votes |
/** * Start the controller service. * * @param wait boolean to wait until service is running */ @Override public void start(final boolean wait) { deleteApp("/pravega/controller"); log.debug("Starting service: {}", getID()); try { marathonClient.createApp(createPravegaControllerApp()); if (wait) { waitUntilServiceRunning().get(10, TimeUnit.MINUTES); } } catch (MarathonException e) { handleMarathonException(e); } catch (InterruptedException | ExecutionException | TimeoutException ex) { throw new TestFrameworkException(InternalError, "Exception while " + "starting Pravega Controller Service", ex); } }
Example #8
Source File: PravegaSegmentStoreService.java From pravega with Apache License 2.0 | 6 votes |
@Override public void start(final boolean wait) { deleteApp("/pravega/segmentstore"); log.info("Starting Pravega SegmentStore Service: {}", getID()); try { marathonClient.createApp(createPravegaSegmentStoreApp()); if (wait) { waitUntilServiceRunning().get(10, TimeUnit.MINUTES); } } catch (MarathonException e) { handleMarathonException(e); } catch (InterruptedException | ExecutionException | TimeoutException ex) { throw new TestFrameworkException(InternalError, "Exception while " + "starting Pravega SegmentStore Service", ex); } }
Example #9
Source File: MarathonBuilderImpl.java From marathon-plugin with Apache License 2.0 | 6 votes |
/** * Construct a Marathon client based on the provided credentialsId and execute an update for the configuration's * Marathon application. * * @param credentialsId A string ID for a credential within Jenkin's Credential store * @throws MarathonException thrown if the Marathon service has an error */ private void doUpdate(final String credentialsId) throws MarathonException { final Credentials credentials = MarathonBuilderUtils.getJenkinsCredentials(credentialsId, Credentials.class); Marathon client; if (credentials instanceof UsernamePasswordCredentials) { client = getMarathonClient((UsernamePasswordCredentials) credentials); } else if (credentials instanceof StringCredentials) { client = getMarathonClient((StringCredentials) credentials); } else { client = getMarathonClient(); } if (client != null) { client.updateApp(getApp().getId(), getApp(), config.getForceUpdate()); } }
Example #10
Source File: MarathonStep.java From marathon-plugin with Apache License 2.0 | 6 votes |
@Override protected Void run() throws Exception { if (step.getAppid() != null && !step.getAppid().equals("")) { listener.getLogger().println("[Marathon] DEPRECATION WARNING: This configuration is using \"appid\" instead of \"id\". Please update this configuration."); step.setId(step.getAppid()); } try { MarathonBuilder .getBuilder(step) .setEnvVars(envVars) .setWorkspace(ws) .read(step.filename) .build() .toFile() .update(); } catch (MarathonException | MarathonFileInvalidException | MarathonFileMissingException me) { final String errorMsg = String.format("[Marathon] %s", me.getMessage()); listener.error(errorMsg); run.setResult(Result.FAILURE); } return null; }
Example #11
Source File: MarathonServerListFetchZoneTests.java From spring-cloud-marathon with MIT License | 6 votes |
@Test public void test_zone_extracted_list_of_servers() throws MarathonException { ReflectionAssert.assertReflectionEquals( "should be two servers", IntStream.of(1,2) .mapToObj(index -> new MarathonServer( "host" + index + ".dc1", 9090, Collections.emptyList()) .withZone("dc1") ).collect(Collectors.toList()), serverList.getInitialListOfServers().stream() .filter(server -> server.getZone().equals("dc1")) .collect(Collectors.toList()), ReflectionComparatorMode.LENIENT_ORDER ); }
Example #12
Source File: MarathonDiscoveryClient.java From spring-cloud-marathon with MIT License | 6 votes |
private List<ServiceInstance> getInstances(Map<String, String> queryMap) throws MarathonException { List<ServiceInstance> instances = new ArrayList<>(); GetAppsResponse appsResponse = queryMap == null ? client.getApps() : client.getApps(queryMap); if (appsResponse != null && appsResponse.getApps() != null) { List<VersionedApp> apps = appsResponse.getApps(); log.debug("Discovered {} service{}{}", apps.size(), apps.size() == 1 ? "" : "s", queryMap == null ? "" : String.format(" with ids that contain [%s]", queryMap.get("id"))); for (App app : apps) { // Fetch data for this specific service id, to collect task information GetAppResponse response = client.getApp(app.getId()); if (response != null && response.getApp() != null) { instances.addAll(extractServiceInstances(response.getApp())); } } } return instances; }
Example #13
Source File: ControllerFailoverTest.java From pravega with Apache License 2.0 | 5 votes |
@Environment public static void initialize() throws MarathonException, ExecutionException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = startPravegaControllerInstances(zkUri, 1); ensureSegmentStoreRunning(zkUri, controllerUri); }
Example #14
Source File: MarathonDiscoveryClient.java From spring-cloud-marathon with MIT License | 5 votes |
@Override public List<String> getServices() { try { return client.getApps() .getApps() .parallelStream() .map(App::getId) .map(ServiceIdConverter::convertToServiceId) .collect(Collectors.toList()); } catch (MarathonException e) { log.error(e.getMessage(), e); return Collections.emptyList(); } }
Example #15
Source File: WatermarkingTest.java From pravega with Apache License 2.0 | 5 votes |
/** * This is used to setup the various services required by the system test framework. * * @throws MarathonException when error in setup */ @Environment public static void initialize() throws MarathonException, ExecutionException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = startPravegaControllerInstances(zkUri, 2); ensureSegmentStoreRunning(zkUri, controllerUri); }
Example #16
Source File: ReadTxnWriteAutoScaleWithFailoverTest.java From pravega with Apache License 2.0 | 5 votes |
@Environment public static void initialize() throws MarathonException, ExecutionException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = startPravegaControllerInstances(zkUri, 3); startPravegaSegmentStoreInstances(zkUri, controllerUri, 3); }
Example #17
Source File: BookieFailoverTest.java From pravega with Apache License 2.0 | 5 votes |
/** * This is used to setup the various services required by the system test framework. * * @throws MarathonException when error in setup */ @Environment public static void initialize() throws MarathonException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = ensureControllerRunning(zkUri); ensureSegmentStoreRunning(zkUri, controllerUri); }
Example #18
Source File: MarathonDiscoveryClient.java From spring-cloud-marathon with MIT License | 5 votes |
private List<ServiceInstance> getInstance(String serviceId) throws MarathonException { List<ServiceInstance> instances = new ArrayList<>(); GetAppResponse response = client.getApp(ServiceIdConverter.convertToMarathonId(serviceId)); if (response != null && response.getApp() != null) { instances.addAll(extractServiceInstances(response.getApp())); } return instances; }
Example #19
Source File: OffsetTruncationTest.java From pravega with Apache License 2.0 | 5 votes |
/** * This is used to setup the services required by the system test framework. * * @throws MarathonException When error in setup. */ @Environment public static void initialize() throws MarathonException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = ensureControllerRunning(zkUri); ensureSegmentStoreRunning(zkUri, controllerUri); }
Example #20
Source File: StreamCutsTest.java From pravega with Apache License 2.0 | 5 votes |
/** * This is used to setup the services required by the system test framework. * * @throws MarathonException When error in setup. */ @Environment public static void initialize() throws MarathonException, ExecutionException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = ensureControllerRunning(zkUri); ensureSegmentStoreRunning(zkUri, controllerUri); }
Example #21
Source File: ReadTxnWriteScaleWithFailoverTest.java From pravega with Apache License 2.0 | 5 votes |
@Environment public static void initialize() throws MarathonException, ExecutionException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = startPravegaControllerInstances(zkUri, 3); startPravegaSegmentStoreInstances(zkUri, controllerUri, 3); }
Example #22
Source File: MultiReaderWriterWithFailOverTest.java From pravega with Apache License 2.0 | 5 votes |
@Environment public static void initialize() throws MarathonException, ExecutionException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = startPravegaControllerInstances(zkUri, 3); startPravegaSegmentStoreInstances(zkUri, controllerUri, 3); }
Example #23
Source File: BatchClientSimpleTest.java From pravega with Apache License 2.0 | 5 votes |
/** * This is used to setup the services required by the system test framework. * * @throws MarathonException When error in setup. */ @Environment public static void initialize() throws MarathonException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = ensureControllerRunning(zkUri); ensureSegmentStoreRunning(zkUri, controllerUri); }
Example #24
Source File: RetentionTest.java From pravega with Apache License 2.0 | 5 votes |
/** * This is used to setup the various services required by the system test framework. * * @throws MarathonException when error in setup */ @Environment public static void initialize() throws MarathonException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = ensureControllerRunning(zkUri); ensureSegmentStoreRunning(zkUri, controllerUri); }
Example #25
Source File: ControllerRestApiTest.java From pravega with Apache License 2.0 | 5 votes |
/** * This is used to setup the various services required by the system test framework. * * @throws InterruptedException If interrupted * @throws MarathonException when error in setup * @throws URISyntaxException If URI is invalid */ @Environment public static void initialize() throws MarathonException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = ensureControllerRunning(zkUri); ensureSegmentStoreRunning(zkUri, controllerUri); }
Example #26
Source File: StreamsAndScopesManagementTest.java From pravega with Apache License 2.0 | 5 votes |
/** * This is used to setup the services required by the system test framework. * * @throws MarathonException When error in setup. */ @Environment public static void initialize() throws MarathonException, ExecutionException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = ensureControllerRunning(zkUri); ensureSegmentStoreRunning(zkUri, controllerUri); }
Example #27
Source File: MultiSegmentStoreTest.java From pravega with Apache License 2.0 | 5 votes |
@Environment public static void initialize() throws MarathonException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = ensureControllerRunning(zkUri); ensureSegmentStoreRunning(zkUri, controllerUri); }
Example #28
Source File: ReadWriteAndAutoScaleWithFailoverTest.java From pravega with Apache License 2.0 | 5 votes |
@Environment public static void initialize() throws MarathonException, ExecutionException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = startPravegaControllerInstances(zkUri, 3); startPravegaSegmentStoreInstances(zkUri, controllerUri, 3); }
Example #29
Source File: BookkeeperTest.java From pravega with Apache License 2.0 | 5 votes |
/** * This is used to setup the various services required by the system test framework. * * @throws MarathonException if error in setup */ @Environment public static void initialize() throws MarathonException { Service zk = Utils.createZookeeperService(); if (!zk.isRunning()) { zk.start(true); } Service bk = Utils.createBookkeeperService(zk.getServiceDetails().get(0)); if (!bk.isRunning()) { bk.start(true); } }
Example #30
Source File: MultiReaderTxnWriterWithFailoverTest.java From pravega with Apache License 2.0 | 5 votes |
@Environment public static void initialize() throws MarathonException, ExecutionException { URI zkUri = startZookeeperInstance(); startBookkeeperInstances(zkUri); URI controllerUri = startPravegaControllerInstances(zkUri, 3); startPravegaSegmentStoreInstances(zkUri, controllerUri, 3); }