Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Updates #77

Merged
merged 73 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
07b1f81
Mit diesem Pull Request habe ich alle Konflikte behoben und die Änder…
Jan 17, 2024
9647a10
Public access to instantiate_pipeline is required to instantiate with…
Jan 17, 2024
4c44d65
Allow the cancellation of a process by calling interrupt.
Jan 19, 2024
4b8f30f
Utility function to get output files from a path.
Jan 19, 2024
7e1e1ea
Renamed getter and setter for isFinished to match DUUIDocument. Added…
Jan 19, 2024
b14baff
Update the error message to not point to the input path.
Jan 23, 2024
729113f
The reader now show the document's path instead of its name for bette…
Jan 23, 2024
ebec01e
Improved error messages
Jan 23, 2024
aee8ecd
Attempt to create an AE (writer) that does not write the cas to disk …
Jan 23, 2024
d1c766f
Commented out incompatible mongodb version for now
Jan 23, 2024
2a9c57e
Once finished the document counts all annotations made and prepares i…
Jan 24, 2024
d7f365b
Finally added the option to specify a path to create folder instead o…
Jan 26, 2024
b41ef82
Added automatic document upload using the specified handler as soon a…
Jan 26, 2024
905bd89
Clear the bytes in the document after processing to save memory.
Jan 28, 2024
44b8496
Merge pull request #63 from CedricBorko/duui-web
abrami Jan 30, 2024
cf235aa
Small update to the Local Data Reader and Document classes
Jan 31, 2024
4b57194
Allow for pipelines to be instantiated and reused later.
Feb 2, 2024
1f05fed
Merge pull request #65 from CedricBorko/duui-web
abrami Feb 2, 2024
d133d8a
update to uima-3; still todo: textimager-uima-typesystem...
abrami Feb 27, 2024
9b190ba
update uima-3
abrami Feb 28, 2024
ef7b992
update to uima-3
abrami Feb 28, 2024
52897f0
Update DockerUnifiedUIMAInterface
abrami Mar 5, 2024
25064f5
small modification
abrami Mar 5, 2024
801663b
Minio bug fix
Mar 6, 2024
f9de24b
Merge branch 'texttechnologylab:web-api' into web-api
CedricBorko Mar 6, 2024
b962668
Merge pull request #68 from CedricBorko/web-api
abrami Mar 6, 2024
8171a92
Merge pull request #69 from abrami/uima-3
abrami Mar 6, 2024
e060a15
update pom.xml
abrami Mar 6, 2024
159e53e
Merge branch 'texttechnologylab:uima-3' into uima-3
abrami Mar 6, 2024
a7bf695
Merge pull request #70 from abrami/uima-3
abrami Mar 6, 2024
0301ce0
Merge remote-tracking branch 'upstream/web-api' into uima-3
abrami Mar 6, 2024
e8f07eb
merge web-api and repair errors.
abrami Mar 6, 2024
672b9ef
Merge remote-tracking branch 'origin/uima-3' into uima-3
abrami Mar 6, 2024
2d73942
Merge pull request #71 from abrami/uima-3
abrami Mar 6, 2024
de8f257
small updates
abrami Mar 7, 2024
b663232
Merge branch 'texttechnologylab:uima-3' into uima-3
abrami Mar 7, 2024
7cef243
Merge pull request #72 from abrami/uima-3
abrami Mar 7, 2024
fd81439
WIP runSegmented
Myyyvothrr Mar 22, 2024
4ef4241
WIP runSegmented
Myyyvothrr Mar 28, 2024
de2f0b7
WIP runSegmented
Myyyvothrr Apr 5, 2024
93a31bb
feat: added document locking
TheBv Apr 10, 2024
fe2775e
feat: added merging and basic benchmark test
TheBv Apr 11, 2024
8784587
fix: fixed issues with typesystem, added workaround for issues with x…
TheBv Apr 12, 2024
9d53ec2
release 1.3
abrami May 6, 2024
01197ba
Merge pull request #74 from abrami/uima-3
abrami May 6, 2024
02ef66c
Create CNAME
abrami May 8, 2024
b333fee
Update CNAME
abrami May 8, 2024
eb8c4c5
Update CNAME
abrami May 8, 2024
d7588bd
Update CNAME
abrami May 8, 2024
7e3680e
Delete CNAME
abrami May 8, 2024
065f807
Merge pull request #1 from TheBv/featureRunSegmented
Myyyvothrr May 16, 2024
91bc77d
Merge branch 'uima-3' into featureRunSegmented
Myyyvothrr May 16, 2024
1262314
Merge pull request #75 from Myyyvothrr/featureRunSegmented
Myyyvothrr May 16, 2024
54ccdc4
Readability HTML Reader
Myyyvothrr May 17, 2024
120ec5d
fix begin
Myyyvothrr May 17, 2024
d8a7fa6
Google SERP HTML Reader
Myyyvothrr May 17, 2024
7e7f49c
Filereader .bz2
Myyyvothrr May 17, 2024
ebaef70
spacy
Myyyvothrr May 18, 2024
b964c7e
Merge branch 'uima-3' of github.com:Myyyvothrr/DockerUnifiedUIMAInter…
Myyyvothrr May 18, 2024
4eec115
process using list
May 18, 2024
1e29703
core
Myyyvothrr May 22, 2024
a9fad1f
skip existing in DUUIFileReader
Myyyvothrr May 22, 2024
5b1ce9b
NegLab.java
abrami May 23, 2024
c9a9938
Merge branch 'texttechnologylab:uima-3' into uima-3
Myyyvothrr Jun 4, 2024
990210d
WIP javadoc
Jun 4, 2024
cf2febc
Neglab
abrami Jun 7, 2024
ca4523d
NegLab.java
abrami Jun 10, 2024
dfa7aa7
Neglab
abrami Jun 14, 2024
c627d51
Merge pull request #76 from Myyyvothrr/uima-3
abrami Jun 18, 2024
35d62b1
Create _config.yml
abrami Jun 18, 2024
abf2a01
Adding bz2 for Lazy
abrami Jun 24, 2024
aaf1377
Merge remote-tracking branch 'upstream/uima-3' into uima-3
abrami Jul 3, 2024
ee71770
Updates for Segmentation
abrami Jul 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
theme: jekyll-theme-minimal
title: Docker Unified UIMA Interface
description: A framework at the dawn of a new era for NLP processing
481 changes: 332 additions & 149 deletions pom.xml

Large diffs are not rendered by default.

433 changes: 0 additions & 433 deletions src/main/java/org/apache/uima/cas/impl/XmiSerializationSharedData.java

This file was deleted.

1,770 changes: 1,514 additions & 256 deletions src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/DUUIComposer.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,42 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CancellationException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

import static java.lang.String.format;

//TODO: Enable different tags here
class PullImageStdout extends PullImageResultCallback {
private String _status;
private final AtomicBoolean shutdown;

PullImageStdout() {
PullImageStdout(AtomicBoolean shutdown) {
_status = "";
this.shutdown = shutdown;
}

@Override
public void onNext(PullResponseItem item) {
if (shutdown.get()) {
onComplete();
onError(new CancellationException("Pull has been cancelled."));
return;
}

if (item.getStatus() != null) {
_status = item.getStatus();
}

if (item.getProgressDetail() != null) {
if (item.getProgressDetail().getCurrent() != null && item.getProgressDetail().getTotal() != null) {
System.out.printf("[DockerSwarmDriver] %s: %.2f%%\n", _status, ((float) item.getProgressDetail().getCurrent() / (float) item.getProgressDetail().getTotal()) * 100);
float progress = ((float) item.getProgressDetail().getCurrent() / (float) item.getProgressDetail().getTotal()) * 100;
} else {
System.out.printf("[DockerSwarmDriver] %s.\n", _status);
}
}
}

}

class PushImageStdout extends ResultCallback.Adapter<PushResponseItem> {
Expand Down Expand Up @@ -154,16 +163,16 @@ public class DUUIDockerInterface {
public DUUIDockerInterface() throws IOException {

// GREAT TODO!!!
// URI dockerClientURI;
// if (System.getProperty("os.name").toLowerCase().contains("windows")) {
// dockerClientURI = URI.create("npipe:////./pipe/docker_engine");
// } else {
// dockerClientURI = URI.create("tcp://localhost:2375");
// }
//
// _docker = DockerClientBuilder.getInstance()
// .withDockerHttpClient(new ApacheDockerHttpClient.Builder()
// .dockerHost(dockerClientURI).build()).build();
//URI dockerClientURI;
//if (System.getProperty("os.name").toLowerCase().contains("windows")) {
// dockerClientURI = URI.create("npipe:////./pipe/docker_engine");
//} else {
// dockerClientURI = URI.create("tcp://localhost:2375");
//}

//_docker = DockerClientBuilder.getInstance()
// .withDockerHttpClient(new ApacheDockerHttpClient.Builder()
// .dockerHost(dockerClientURI).build()).build();
_docker = DockerClientBuilder.getInstance().build();


Expand All @@ -181,7 +190,7 @@ public DUUIDockerInterface() throws IOException {
*/
public int extract_port_mapping(String containerid) throws InterruptedException {
InspectContainerResponse container
= _docker.inspectContainerCmd(containerid).exec();
= _docker.inspectContainerCmd(containerid).exec();

int innerport = 0;
for (Map.Entry<ExposedPort, Ports.Binding[]> port : container.getNetworkSettings().getPorts().getBindings().entrySet()) {
Expand All @@ -203,7 +212,7 @@ public int extract_port_mapping(String containerid) throws InterruptedException
*/
public int extract_port_mapping(String containerid, int portMapping) throws InterruptedException {
InspectContainerResponse container
= _docker.inspectContainerCmd(containerid).exec();
= _docker.inspectContainerCmd(containerid).exec();

int innerport = 0;
for (Map.Entry<ExposedPort, Ports.Binding[]> port : container.getNetworkSettings().getPorts().getBindings().entrySet()) {
Expand Down Expand Up @@ -261,14 +270,14 @@ public String get_ip() {
public String get_logs(String containerid) throws InterruptedException {
final List<String> logs = new ArrayList<>();
InspectContainerResponse container
= _docker.inspectContainerCmd(containerid).exec();
= _docker.inspectContainerCmd(containerid).exec();
_docker.logContainerCmd(containerid).withContainerId(containerid).withStdOut(true).withStdErr(true)
.withTimestamps(true).withTail(5).exec(new LogContainerResultCallback() {
@Override
public void onNext(Frame item) {
logs.add(item.toString());
}
}).awaitCompletion();
.withTimestamps(true).withTail(5).exec(new LogContainerResultCallback() {
@Override
public void onNext(Frame item) {
logs.add(item.toString());
}
}).awaitCompletion();
String completelog = "";
for (String x : logs) {
completelog += x;
Expand All @@ -282,7 +291,7 @@ public void onNext(Frame item) {
* @param id The id of the container to stop.
*/
public void stop_container(String id) {
try{
try {
_docker.stopContainerCmd(id).withTimeout(10).exec();
} catch (NotModifiedException e) {
} catch (Exception e) {
Expand Down Expand Up @@ -313,14 +322,14 @@ public void export_to_new_image(String containerid, String imagename) {

public Image getLocalImage(String imageName) {
List<Image> images = _docker.listImagesCmd()
.withShowAll(true)
.exec();
for(Image i : images) {
if(i.getId() == imageName) {
.withShowAll(true)
.exec();
for (Image i : images) {
if (i.getId() == imageName) {
return i;
}
String[] repoTags = i.getRepoTags();
if(repoTags!=null) {
if (repoTags != null) {
for (String repo : repoTags) {
if (repo.equals(imageName)) {
return i;
Expand All @@ -331,32 +340,32 @@ public Image getLocalImage(String imageName) {
return null;
}

public void push_image(String remoteName, String localName,String username, String password) throws InterruptedException {
public void push_image(String remoteName, String localName, String username, String password) throws InterruptedException {
Image img = getLocalImage(localName);
if(img==null) {
throw new InvalidParameterException(format("Could not find local image %s, not attempting to upload it to a registry!",localName));
if (img == null) {
throw new InvalidParameterException(format("Could not find local image %s, not attempting to upload it to a registry!", localName));
}

_docker.tagImageCmd(localName,remoteName,"latest").exec();
if(username!=null && password!=null) {
_docker.tagImageCmd(localName, remoteName, "latest").exec();
if (username != null && password != null) {
AuthConfig cfg = new AuthConfig();
cfg.withPassword(password);
cfg.withUsername(username);
_docker.pushImageCmd(remoteName)
.withAuthConfig(cfg)
.exec(new PushImageStdout())
.awaitCompletion();
}
else {
.withAuthConfig(cfg)
.exec(new PushImageStdout())
.awaitCompletion();
} else {
_docker.pushImageCmd(remoteName)
.exec(new PushImageStdout())
.awaitCompletion();
.exec(new PushImageStdout())
.awaitCompletion();
}
}

public String run_service(String imagename, int scale) throws InterruptedException {
return run_service(imagename, scale, new ArrayList<>(0));
}

public String run_service(String imagename, int scale, List<String> constraints) throws InterruptedException {
ServiceSpec spec = new ServiceSpec();
ServiceModeConfig cfg = new ServiceModeConfig();
Expand All @@ -369,7 +378,7 @@ public String run_service(String imagename, int scale, List<String> constraints)
ContainerSpec cont = new ContainerSpec();
cont = cont.withImage(imagename);
task.withContainerSpec(cont);
if(constraints.size()>0) {
if (constraints.size() > 0) {
task.withPlacement(new ServicePlacement().withConstraints(constraints));
}

Expand All @@ -386,26 +395,25 @@ public String run_service(String imagename, int scale, List<String> constraints)

public boolean hasLocalImage(String imageName) {
InspectImageResponse resp = _docker.inspectImageCmd(imageName).exec();
if(resp!=null) {
if (resp != null) {
return true;
}

List<Image> images = _docker.listImagesCmd()
.withShowAll(true)
.exec();
for(Image i : images) {
if(i.getId() == imageName) {
.withShowAll(true)
.exec();
for (Image i : images) {
if (i.getId() == imageName) {
return true;
}

if(i.getRepoTags()!=null) {
if (i.getRepoTags() != null) {
for (String repo : i.getRepoTags()) {
if (repo.equals(imageName)) {
return true;
}
}
}
else if(i.getRepoDigests()!=null) {
} else if (i.getRepoDigests() != null) {
for (String dig : i.getRepoDigests()) {
if (dig.equals(imageName)) {
return true;
Expand All @@ -422,8 +430,8 @@ public DockerClient getDockerClient() {

public String build(Path builddir, List<String> buildArgs) {
BuildImageCmd buildCmd = _docker.buildImageCmd().withPull(true)
.withBaseDirectory(builddir.toFile())
.withDockerfile(Paths.get(builddir.toString(), "dockerfile").toFile());
.withBaseDirectory(builddir.toFile())
.withDockerfile(Paths.get(builddir.toString(), "dockerfile").toFile());

for (String buildArg : buildArgs) {
String[] fields = buildArg.split("=", 2);
Expand All @@ -441,44 +449,64 @@ public boolean isSwarmManagerNode() {
return sw.getSwarm().getControlAvailable();
}


public String pullImage(String tag) throws InterruptedException {
return pullImage(tag, null, null);
}

public String pullImage(String tag,String username, String password) throws InterruptedException {

public String pullImage(String tag, String username, String password) throws InterruptedException {
return pullImage(tag, username, password, null);
}

/**
* Attempts to pull a docker image using its tag, and credentials if necessary.
*
* @param tag The unique identifier of the image (uri:version).
* @param username Credentials username.
* @param password Credentials password.
* @param shutdown A flag to signal a pull cancel.
* @return The image tag.
* @throws InterruptedException
*/
public String pullImage(String tag, String username, String password, AtomicBoolean shutdown) throws InterruptedException {

try {
if (username != null && password != null) {
AuthConfig cfg = new AuthConfig();
cfg.withUsername(username);
cfg.withPassword(password);
ResultCallbackTemplate temp = _docker.pullImageCmd(tag)
.withAuthConfig(cfg)
.exec(new PullImageStdout());
.withAuthConfig(cfg)
.exec(new PullImageStdout(shutdown));
temp.onError(new Exception());
temp.awaitCompletion();
} else {

ResultCallbackTemplate template = _docker.pullImageCmd(tag)
.exec(new PullImageStdout());
template.onError(new Exception());
.exec(new PullImageStdout(shutdown));

// What is the purpose of throwing an Exception every time?
template.awaitCompletion();
}
}
catch(Exception e) {
} catch (CancellationException exception) {
shutdown.set(true);
} catch (Exception e) {
e.printStackTrace();
System.out.printf("Could not fetch image %s, continuing without.\n",tag);
System.out.printf("Could not fetch image %s, continuing without.\n", tag);
}
return tag;
}

public String getDigestFromImage(String imagename) {

if(imagename.split(":").length == 1) {
imagename = imagename+":latest";
if (imagename.split(":").length == 1) {
imagename = imagename + ":latest";
}
InspectImageResponse resp = _docker.inspectImageCmd(imagename).exec();
List<String> digests = resp.getRepoDigests();

for(String i : digests) {
for (String i : digests) {
return i;
}
return null;
Expand All @@ -501,15 +529,15 @@ public String run(String imageid, boolean gpu, boolean autoremove, int port, boo
}
if (gpu) {
cfg = cfg.withDeviceRequests(ImmutableList.of(new DeviceRequest()
.withCapabilities(ImmutableList.of(ImmutableList.of("gpu")))));
.withCapabilities(ImmutableList.of(ImmutableList.of("gpu")))));
}

if(mapDaemon) {
if (mapDaemon) {
cfg = cfg.withBinds(Bind.parse("/var/run/docker.sock:/var/run/docker.sock"));
}
CreateContainerCmd cmd = _docker.createContainerCmd(imageid)
.withHostConfig(cfg)
.withExposedPorts(ExposedPort.tcp(port)).withPublishAllPorts(true);
.withHostConfig(cfg)
.withExposedPorts(ExposedPort.tcp(port)).withPublishAllPorts(true);

CreateContainerResponse feedback = cmd.exec();
_docker.startContainerCmd(feedback.getId()).exec();
Expand All @@ -533,17 +561,17 @@ public String run(String imageid, boolean gpu, boolean autoremove, int portConta
}
if (gpu) {
cfg = cfg.withDeviceRequests(ImmutableList.of(new DeviceRequest()
.withCapabilities(ImmutableList.of(ImmutableList.of("gpu")))));
.withCapabilities(ImmutableList.of(ImmutableList.of("gpu")))));
}

cfg.withPortBindings(new PortBinding(new Ports.Binding(null,String.valueOf(portHost)), new ExposedPort(portContainer)));
cfg.withPortBindings(new PortBinding(new Ports.Binding(null, String.valueOf(portHost)), new ExposedPort(portContainer)));

if(mapDaemon) {
if (mapDaemon) {
cfg = cfg.withBinds(Bind.parse("/var/run/docker.sock:/var/run/docker.sock"));
}
CreateContainerCmd cmd = _docker.createContainerCmd(imageid)
.withHostConfig(cfg)
.withExposedPorts(ExposedPort.tcp(portContainer)).withPublishAllPorts(true);
.withHostConfig(cfg)
.withExposedPorts(ExposedPort.tcp(portContainer)).withPublishAllPorts(true);

CreateContainerResponse feedback = cmd.exec();
_docker.startContainerCmd(feedback.getId()).exec();
Expand Down
Loading