Skip to content

Conversation

L1uTongweiNewAccount
Copy link
Contributor

This PR will upload a folder named scripts to save all scripts.

Updated:

  • Bash Script freeroutingd (Freerouting Daemon) to automatically make a fake X11 desktop to run headless freerouting.
  • C++ program freeroutingp (Freerouting Progress) translate the log of freerouting to stderr stream by pipe.
  • A fast test dsn file as tests/FastTest.dsn

Set environment variable JAVA, you can set the jre what freerouting uses.

Set environment variable ARG_GUI can enable GUI (for OS like Windows)

Now we only can write {"status": "startRoute"}, {"status": "routeProgress"}, {"status": "routeResult"}, {"status": "startOptimize"} and {"status": "optimizeResult"}.

Bugs:

  • {"status": "routeProgress"} doesn't work in my computer. Because no message Saving xxx... sent. Please update log system to output real information in routing, like pass number, etc.
  • Sometimes the freerouting will push a dialog like "There is a snapshot. Would you like use this snapshot?". Headless cannot cancel this dialog.
  • Sometimes there will be a net exception. But no effect for auto-routing.

like:

java.util.concurrent.CompletionException: java.net.ConnectException
        at java.base/java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:368)
        at java.base/java.util.concurrent.CompletableFuture.completeRelay(CompletableFuture.java:377)
        at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1152)
        at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1773)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.net.ConnectException
        at java.net.http/jdk.internal.net.http.common.Utils.toConnectException(Utils.java:1028)
        at java.net.http/jdk.internal.net.http.PlainHttpConnection.connectAsync(PlainHttpConnection.java:227)
        at java.net.http/jdk.internal.net.http.PlainHttpConnection.checkRetryConnect(PlainHttpConnection.java:280)
        at java.net.http/jdk.internal.net.http.PlainHttpConnection.lambda$connectAsync$2(PlainHttpConnection.java:238)
        at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:934)
        at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:911)
        ... 5 more
Caused by: java.nio.channels.ClosedChannelException
        at java.base/sun.nio.ch.SocketChannelImpl.ensureOpen(SocketChannelImpl.java:202)
        at java.base/sun.nio.ch.SocketChannelImpl.beginConnect(SocketChannelImpl.java:786)
        at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:874)
        at java.net.http/jdk.internal.net.http.PlainHttpConnection.lambda$connectAsync$1(PlainHttpConnection.java:210)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
        at java.net.http/jdk.internal.net.http.PlainHttpConnection.connectAsync(PlainHttpConnection.java:212)
        ... 9 more

@L1uTongweiNewAccount
Copy link
Contributor Author

For now, freeroutingp is just for test.

We must update the log system to provide more information, and freeroutingp will be more useful.

If we can convert .ses to EasyEDA's API format, we can compatible with it. (See #311)

(For now, I can't, but maybe I can develop a electron plugin for EasyEDA, and it also can make the same effect)

And thanks for @leoheck to provide this idea in #241.

@andrasfuchs

@andrasfuchs
Copy link
Collaborator

This is great work, thank you @L1uTongweiNewAccount!

Could you include some batch nstructions how to compile the .cpp file? I can see the Makefile, but what tools I need to install for it to work?

It would be great if I could build and test it locally.

@L1uTongweiNewAccount
Copy link
Contributor Author

L1uTongweiNewAccount commented Jun 23, 2024

@andrasfuchs

Just make.

You may need g++ and bash, only these.

@andrasfuchs
Copy link
Collaborator

@L1uTongweiNewAccount

I could make the C++ compilation work on Ubuntu 👍

Added a README to make it easier for others to use these scripts.

Regarding the bugs:

@andrasfuchs
Copy link
Collaborator

I added the '-ll' command line argument for the ability to change the file log level.

@andrasfuchs andrasfuchs merged commit 9be9912 into freerouting:master Jun 27, 2024
@L1uTongweiNewAccount
Copy link
Contributor Author

@andrasfuchs I am very sorry about I did not say clearly that how to use it.

I will write a better README and optimize the new freeroutingp with new log level (I will force it in freeroutingd)

Now freeroutingd just a launcher.

@L1uTongweiNewAccount
Copy link
Contributor Author

@andrasfuchs Anyway, It's not enough good for this PR. I will improve it quickly,

@andrasfuchs
Copy link
Collaborator

Great, and no worries, take your time.
You can always create a new PR with your improvements.

Thank you again for your contribution!

@L1uTongweiNewAccount
Copy link
Contributor Author

@andrasfuchs I built the latest version and use the command line -ll DEBUG or -ll 7

But no change shown.

If there is ever no DEBUG message? Or this is a bug?

If you can, please provide useable pre-build version for me.

@andrasfuchs
Copy link
Collaborator

You must use the snapshot version from here: https://github.com/freerouting/freerouting/releases/tag/SNAPSHOT

@L1uTongweiNewAccount
Copy link
Contributor Author

You must use the snapshot version from here: https://github.com/freerouting/freerouting/releases/tag/SNAPSHOT

Thanks very much!

@L1uTongweiNewAccount
Copy link
Contributor Author

L1uTongweiNewAccount commented Jun 27, 2024

@andrasfuchs Please run

cd scripts
./freeroutingd -jar ../build/freerouting.jar -de ../tests/FastTest.dsn -do test.ses -ll 7

I am sure I have no wrong with my build, also no response from SNAPSHOT version.

Here is the output:

_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root
2024-06-27 20:58:12.892 [main] INFO  Freerouting v2.0.0-SNAPSHOT (build-date: 2024-06-27)
2024-06-27 20:58:12.996 [main] INFO  Settings were loaded from freerouting.json
2024-06-27 20:58:14.148 [main] INFO  Opening '../tests/FastTest.dsn'...
2024-06-27 20:58:18.601 [main] INFO  Multi-threading is disabled in the settings. Using single thread.
{"status": "startRoute"}
2024-06-27 20:58:18.633 [Thread-1] INFO  Starting auto-routing...
{"status": "routingResult"}2024-06-27 20:58:19.396 [Thread-1] INFO  Auto-routing was completed in 0.76 seconds.
{"status": "startOptimize"}
2024-06-27 20:58:19.498 [Thread-1] INFO  Starting route optimization on 1 thread...
{"status": "optimizeResult"}
2024-06-27 20:58:19.509 [Thread-1] INFO  Route optimization was completed in 0.01 seconds.
{"status": "routingProgress"}2024-06-27 20:58:19.529 [Thread-0] INFO Auto-routing progress #1 completed in 0.000000 seconds.2024-06-27 20:58:19.529 [Thread-1] INFO  Saving 'test.ses'...

@andrasfuchs
Copy link
Collaborator

I run the following and got debug messages as well:

java -jar freerouting-SNAPSHOT-20240627_092100.jar -ll ALL

@andrasfuchs
Copy link
Collaborator

There might be an issue with the changeFileLogLevel method in some cases where the LoggerContext is not an instance of org.apache.logging.log4j.core.LoggerContext. So if you still don't get the debug messages, that might be the reason, and I need to spend more time on it later.

@L1uTongweiNewAccount
Copy link
Contributor Author

@andrasfuchs The latest news is I found there is a bug that:

I can found debug message in logs/ folder

I cannout found debug message in stderr/stdout

@L1uTongweiNewAccount
Copy link
Contributor Author

@andrasfuchs Maybe I can take over the connection between freerouting and log file.

But the easier method is fix the bug and we can get them in stdout

@L1uTongweiNewAccount
Copy link
Contributor Author

Anyway, I am seeing the log file and believe I am seeing stdout.

You may add a option to disable the file log out.

@L1uTongweiNewAccount
Copy link
Contributor Author

what is 2024-06-27 23:46:27.211 [main] INFO Multi-threading is disabled in the settings. Using single thread.?

@L1uTongweiNewAccount
Copy link
Contributor Author

And there is also a problem:

You may output progress in INFO information.

I cannot infer any progress in DEBUG information.

e.g.

INFO Progress: Auto-routing xxx To-route: xxx Completed: xxx Failed: xxx ...
INFO Progress: Optimize xxx ...

(Mind ... and space)

@L1uTongweiNewAccount
Copy link
Contributor Author

All right, I will move this issue to a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants