Skip to content

Commit

Permalink
remove user email from metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeSeqLabs committed Dec 4, 2023
1 parent 12a6aa3 commit faaec0f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 31 deletions.
2 changes: 1 addition & 1 deletion conf/reflect-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,7 @@
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true,
"methods":[{"name":"getPipelineId","parameterTypes":[] }, {"name":"getUserEmail","parameterTypes":[] }, {"name":"getUserId","parameterTypes":[] }, {"name":"getWorkspaceId","parameterTypes":[] }, {"name":"getWorkspaceName","parameterTypes":[] }, {"name":"getRunUrl","parameterTypes":[] }, {"name":"getLabels","parameterTypes":[] }]
"methods":[{"name":"getLabels","parameterTypes":[] }, {"name":"getPipelineId","parameterTypes":[] }, {"name":"getRunUrl","parameterTypes":[] }, {"name":"getUserId","parameterTypes":[] }, {"name":"getWorkspaceId","parameterTypes":[] }, {"name":"getWorkspaceName","parameterTypes":[] }]
},
{
"name":"io.seqera.tower.cli.utils.VersionProvider",
Expand Down
24 changes: 2 additions & 22 deletions src/main/java/io/seqera/tower/cli/commands/runs/DumpCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
import io.seqera.tower.model.DescribeWorkflowLaunchResponse;
import io.seqera.tower.model.DescribeWorkflowResponse;
import io.seqera.tower.model.Launch;
import io.seqera.tower.model.ListParticipantsResponse;
import io.seqera.tower.model.ListTasksResponse;
import io.seqera.tower.model.ParticipantDbDto;
import io.seqera.tower.model.ServiceInfo;
import io.seqera.tower.model.Task;
import io.seqera.tower.model.TaskStatus;
Expand Down Expand Up @@ -191,23 +189,6 @@ private void dumpWorkflowDetails(PrintWriter progress, TarArchiveOutputStream ou
}
}

// User info
Long userId = workflow.getOwnerId();
String userMail = null;
String userName = workflow.getUserName();
try {
/*
* There is no way of obtaining the user email directly, we need to extract it out of the workspace participant list.
* List the participants of the workspace, find the participant by username, then return that participant email.
*/
ListParticipantsResponse participants = api().listWorkspaceParticipants(workflowResponse.getOrgId(), workflowResponse.getWorkspaceId(), null, null, null);
userMail = participants.getParticipants().stream()
.filter(participant -> userName.equals(participant.getUserName()))
.findFirst()
.map(ParticipantDbDto::getEmail)
.orElse(null);
} catch (ApiException ignored) {}

// Load and metrics info
WorkflowLoad workflowLoad = workflowLoadByWorkflowId(wspId, id);
List<WorkflowMetrics> metrics = api().describeWorkflowMetrics(workflow.getId(), wspId).getMetrics();
Expand All @@ -216,9 +197,8 @@ private void dumpWorkflowDetails(PrintWriter progress, TarArchiveOutputStream ou
pipelineId,
wspId,
workflowResponse.getWorkspaceName(),
userId,
userMail,
generateUrl(wspId, userName, workflow.getId()),
workflow.getOwnerId(),
generateUrl(wspId, workflow.getUserName(), workflow.getId()),
workflowResponse.getLabels()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public final class WorkflowMetadata {

private final Long userId;

private final String userEmail;

private final String runUrl;

private final List<LabelDbDto> labels;
Expand All @@ -46,15 +44,13 @@ public WorkflowMetadata(
final Long workspaceId,
final String workspaceName,
final Long userId,
final String userEmail,
final String runUrl,
final List<LabelDbDto> labels
) {
this.pipelineId = pipelineId;
this.workspaceId = workspaceId;
this.workspaceName = workspaceName;
this.userId = userId;
this.userEmail = userEmail;
this.runUrl = runUrl;
this.labels = labels;
}
Expand All @@ -75,10 +71,6 @@ public Long getUserId() {
return userId;
}

public String getUserEmail() {
return userEmail;
}

public String getRunUrl() {
return runUrl;
}
Expand Down

0 comments on commit faaec0f

Please sign in to comment.