Skip to content

Commit

Permalink
Rename Agent key to Agent connection ID. Resolves #1
Browse files Browse the repository at this point in the history
  • Loading branch information
jordeu committed Oct 28, 2021
1 parent bb71872 commit 5fa97dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/main/java/io/seqera/tower/agent/Agent.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import io.micronaut.rxjava2.http.client.websockets.RxWebSocketClient;
import io.micronaut.scheduling.TaskScheduler;
import io.micronaut.websocket.exceptions.WebSocketClientException;
import io.seqera.tower.agent.exchange.CommandResponse;

import java.net.URI;
import java.net.URISyntaxException;
Expand All @@ -23,7 +22,7 @@

@Command(
name = "tw-agent",
description = "Nextflow Tower anywhere agent",
description = "Nextflow Tower Agent",
headerHeading = "%n",
versionProvider = VersionProvider.class,
mixinStandardHelpOptions = true,
Expand All @@ -40,7 +39,7 @@ public class Agent implements Runnable {
private static Logger logger = LoggerFactory.getLogger(Agent.class);
private ApplicationContext ctx;

@Parameters(index = "0", paramLabel = "AGENT_KEY", description = "Agent key to identify this agent", arity = "1")
@Parameters(index = "0", paramLabel = "AGENT_CONNECTION_ID", description = "Agent connection ID to identify this agent", arity = "1")
String agentKey;

@Option(names = {"-t", "--access-token"}, description = "Tower personal access token (TOWER_ACCESS_TOKEN)", defaultValue = "${TOWER_ACCESS_TOKEN}")
Expand Down
13 changes: 5 additions & 8 deletions src/main/java/io/seqera/tower/agent/AgentClientSocket.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package io.seqera.tower.agent;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.nio.charset.MalformedInputException;
import java.time.Duration;
import java.time.Instant;

import io.micronaut.http.HttpRequest;
import io.micronaut.websocket.WebSocketSession;
import io.micronaut.websocket.annotation.ClientWebSocket;
Expand All @@ -17,21 +11,24 @@
import io.seqera.tower.agent.exchange.CommandResponse;
import io.seqera.tower.agent.exchange.HeartbeatMessage;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.time.Duration;
import java.time.Instant;

/**
* @author Jordi Deu-Pons <jordi@seqera.io>
*/
@ClientWebSocket
abstract class AgentClientSocket implements AutoCloseable {

private WebSocketSession session;
private HttpRequest request;

private Instant openingTime;

@OnOpen
void onOpen(WebSocketSession session, HttpRequest request) {
this.session = session;
this.request = request;
this.openingTime = Instant.now();
System.out.println("Client opened connection");
}
Expand Down

0 comments on commit 5fa97dc

Please sign in to comment.