Pages:
Author

Topic: Crypto Miners In Tray - a lightweight front-end for unattended mining (Read 25815 times)

legendary
Activity: 1680
Merit: 1014
I bought UPS'es for some of my machines, and discovered a nice additional functionality that my application provides. Smiley

Initially watchcondition of the form:
Code:
      
was written for use with laptops CPU or cudamining mining scrypt.

I discovered that when I connected a UPS to my PC using USB, then stationary PC started showing battery status and by extension responding to the above event when UPS switches over to battery power. Nice! I can now also reduce power consumption of those power-hungry scrypt-mining GPUs when there's a power failure.
legendary
Activity: 1680
Merit: 1014
Version 7.30 has been released:

– Implement backup argument set rotation for KeepAlive function. This is handy for those miners that do not support specification of backup pools, such as cpuminer, poclbm and cudaminer.
– Fix an issue, where log file would be rotated twice when configuration file is reloaded.
– Fix a bug, where a miner in a profitability group would not get stopped if profitability changes while the miner is in a suspended by watcher state.
legendary
Activity: 1680
Merit: 1014
It is not a script, but an example of a configuration XML for my front-end, presented in this thread. Follow the link in the OP to my blog and download the latest version from there. In the archive you fill find a file BtMinersInTray.xml.example.txt which explains all the available settings. Use that information to adapt the skeleton configuration above to your needs.
full member
Activity: 231
Merit: 100
Hello Nemo:  Thanks but I do not know how to use that script.  Im a bit of noob.  Where would I begin?
legendary
Activity: 1680
Merit: 1014
For those interested in mining multiple coins, based on profitability, here is a minimalistic example configuration file. Just fill in your values in the variables.

Code:


 
 
 

 
 

 
 

 
 

 
 
 
 
 
 
 
   
   
   
   
 


 
   
   
 


 
   
      ${path}
      ${executable}
      ${AmdScryptArgs} ${LtcConnect}
   


   
      ${path}
      ${executable}
      ${AmdScryptArgs} ${FtcConnect}
   


   
      ${path}
      ${executable}
      ${AmdSha256Args} ${BtcConnect}
   


   
      ${path}
      ${executable}
      ${AmdSha256Args} ${PpcConnect}
   


   
      ${path}
      ${executable}
      ${BlockErupterArgs} ${BtcConnect}
   


   
      ${path}
      ${executable}
      ${BlockErupterArgs} ${PpcConnect}
   

 


legendary
Activity: 1680
Merit: 1014
Version 7.21 has been released:

– Fixed a bug, introduced in 7.20, where “Start with Windows” would write incorrect application executable name to registry.
– Fixed logging to file so that the text is auto-flushed, allowing to view the log file while it is being written to.
– Refactored registry accessing methods to facilitate testing.
– Keep using old/stale data from CoinChoose if the site’s API temporarily stops supplying data for a coin.
– Improved error handling in log to file code.

If you had "Run with Windows" enabled, please re-enable it after launching this version manually. A bug in 7.20 resulted in incorrect value being written to the registry, preventing the program from starting with Windows.
legendary
Activity: 1680
Merit: 1014
Version 7.20 has been released:

– Added Execute action to watchers. External command can be launched once watcher condition either becomes positive, negative or in both cases.
– Added possibility to continuously append the output log to file. Log files are rotated with a timestamp on log window clearing. Logging to file is disable by default.
legendary
Activity: 1680
Merit: 1014
Pooler's CpuMiner now (as of version 2.3.2) reports the speed continuously and not in large blocks as it did before.

I have tested CudaMiner and it is fully compatible with the GUI.

Remember to specify readSpeedFrom=”stderr” attribute in the configuration file for both.
legendary
Activity: 1680
Merit: 1014
Version 7.10 has been released:

– Made it possible to define global variables in the configuration file. These variables can then be referenced in any node or attribute, making it easier to update multiple places at once. (on request by Maxocoin)
– Fixed a bug, where the initial state of “Run with Windows” was always checked contrary to the actual state of affairs.
legendary
Activity: 1680
Merit: 1014
can this be used with cgminer ?

Yes. Make sure you pass it --text-only or -T argument.
newbie
Activity: 58
Merit: 0
can this be used with cgminer ?
legendary
Activity: 1680
Merit: 1014
Version 7.00 has been released:

– Implemented “miner profitability grouping”, where the program would choose one of the miners in a group, targeting the same card/hardware for the most profitable coin, using the information from CoinChoose.com. At most one miner in a group can run at any given time. A group is treated as one miner: Hitting “Start” on any miner in a group would start the most profitable miner. Hitting “Stop” on any miner in a group would stop the running miner in that group.
– GUI changes, moving all buttons to the toolbar.
– GUI change, allowing resize of the program window and of the relative proportion between miner list and output text box.
– GUI window size and splitter position between miner list and the log window are saved in the registry and restored upon next program launch.
– Fixed a bug, where custom-selected config file would not be loaded when the program is launched with Windows.
– The program’s name has been changed to “Crypto Miners in Tray” to denote that miners targeting different cryptocoins can be managed from the application. The executable’s name remains the same for backward compatibility.

If anyone would like to fetch profitability data from another provider other than CoinChoose, let me know here. A potential data provider must present it through some form of API (preferably JSON) as I am not going to scrub web pages for data.


NB! If you get a crash "Could not load file or assembly 'System.Web.Extensions, Version=4.0.0.0" when launching Crypto Miners in Tray, it means that you do not have Microsoft .NET Framework 4 installed. Download and install it from Microsoft site: http://www.microsoft.com/en-us/download/details.aspx?id=17718
legendary
Activity: 1680
Merit: 1014
Last month was the ultimate test for my application: managing 4 machines for 3 weeks, completely unattended. All went well (mostly) one machine had OS-related failure after 2 weeks, which BitcoinMiners in Tray would not have been able to handle anyway. The other three machines finished the 3-week period with 100% uptime and 70 to 90 KeepAlive hits each. Without the program, mining would have stopped after a few days.

Next version will see profitability grouping, allowing folk to group several configured mines, working against the same card, but targeting different coins. The coin with the best profitability from a group (as reported by http://www.coinchoose.com/) will be mined. I see this as a new requirement to keep GPU and CPU mining alive in these ASIC-riddled times.

And last, but not least, from the number of hits for this topic and comments here and on my blog, I can surmise that there are a few people finding this program useful and actively using it. However, not a single donation was forthcoming. All proceeds will go to the Durrell Wildlife Conservation Trust, and this is the best incentive for me to keep developing. If you think that you don't need to donate because someone else will, think again: if everyone thinks like that, no one will donate in the end...
legendary
Activity: 1680
Merit: 1014
Version 6.01 has been released:

- Fixed a bug where keepAlive with threshold would stop working if a miner’s hashing speed would drop to 0 right after a successful keepAlive check.
legendary
Activity: 1680
Merit: 1014
Aye, that I have, though there were a few hindrances on the way, particularly the fact that the buffer would often be dumped ending in only a partial line (again, specific to cpuminer). It was also very instructive reading the source for the .Net's Process class and figuring out how to do a partial encapsulation of it, so that all of its functionality that I use still remains available.

Looking back at version 1 here (https://bitcointalksearch.org/topic/m.1561607), the program has come a long way over the period of only a few months...  Cheesy A big round of applause to such concepts as TDD and rapid deployment cycle. Smiley
newbie
Activity: 16
Merit: 0
Quote
– Complete rewrite of the Process launching code, encapsulating the .Net Process class, so as to be able to peek on the stdout/stderr output pipe from the miners, solving the problem with some miners (pooler’s cpuminer) not showing any output until they exit. (Thanks to WebMaka for a lead.)

Yay, you got it to work in .NET! Cheesy
legendary
Activity: 1680
Merit: 1014
Version 6.00 has been released:

– Complete rewrite of the Process launching code, encapsulating the .Net Process class, so as to be able to peek on the stdout/stderr output pipe from the miners, solving the problem with some miners (pooler’s cpuminer) not showing any output until they exit. (Thanks to WebMaka for a lead.)
– All speeds in the balloon tooltip are now shown in the “dot” decimal notation, culture independent
– Added Speed column to the GUI list of miners.
– Added milliseconds to the log timestamp.
– Made config file path in the status bar into a clickable link, which would open Explorer at that path.
– Added restartEvery attribute to the miner node, allowing miners to be force restarted at certain hour intervals.
– Added readSpeedFrom attribute, allowing the user where the hashing speed is parsed from: stdout or stderr.
– Possibility to specify how the miner reports its speed in the list and the tooltip – K, M or G – through the new displaySpeedIn attribute. The total in the tooltip and GUI is always in M.
– Fixed a bug in hashrate-based keepAlive threshold calculation, which resulted in frequent false positives.
– Fixed a problem with disabled auto-scroll. Windows interop EM_GETSCROLLPOS returns scaled down 16-bit values even though it has a 32-bit Point structure at its disposal, resulting in erronous behaviour when the size of the RichTextBox content height exceeds 65535 pixels. A work-around has been applied, which alliviated the problem, though the text would not stay completely still.
– Fixed an off-by-one error in average speed calculation.
– The donation hint now points to Durrell Wildlife Conservation Trust fund-raising: 1DodoExzsNPvVRXFrgkKw6E259VjfUW8Kh

EDIT: An update on compatibility:
A note about Pooler’s cpuminer for Litecoins – Bitcoin Miners in Tray can run and control it, but due to two quirks, the output from cpuminer is displayed in bursts. Cpuminer directs all of its output to stderr, which BMT handles well. However, it does not finish output of a line when a line is written to stderr, thus all lines are dumped on the pipe as cpuminer’s internal buffer is filled up. There is nothing I can do about it, as this needs to be fixed by Pooler.

CGMiner must be started with --text-only or -T parameter to disable ncurses.
legendary
Activity: 1680
Merit: 1014
A short update: I am working on version 6.00, which incorporates WebMaka's suggestion, as well as several improvements and fixes.

If you find this program useful and use it on a daily basis, please consider donating for a good cause that I am supporting: Durrell Wildlife Conservation Trust

The donation address is 1DodoExzsNPvVRXFrgkKw6E259VjfUW8Kh (or scan the QR code in my profile).

As of version 6.00, the donation request address and QR in the program will also point to the fund-raising drive wallet.
newbie
Activity: 16
Merit: 0
Yeah, I saw that - you're probably going to have to roll a custom pipe peek-and-read, which shouldn't be too difficult with C# given that it does provide enough abstraction to get at what you'd need to get at.

BTW, your code steered me in the right direction on how to properly send a SIGINT or SIGBREAK to a running console application, so apparently we're helping each other, hahaha... (The key turned out to be to do an AttachConsole to hook my app to the miner, disable signal handling in my app, send the signal, then unhook from it.)
legendary
Activity: 1680
Merit: 1014
Thanks for the pointers, WebMaka. I wrote the program in C#. .Net has a class for handling process interaction, including redirects. On the downside, it does not peek. If I were to fix it, I'd basically need to rewrite the whole Process class. The currecnt code looks something like this:

Code:
                MinerProcess = new Process();
                try
                {
                    MinerProcess.StartInfo.WorkingDirectory = WorkingDir;
                    MinerProcess.StartInfo.FileName = Path.Combine(WorkingDir, Application);
                    MinerProcess.StartInfo.Arguments = Arguments;
                    MinerProcess.StartInfo.CreateNoWindow = true;
                    MinerProcess.StartInfo.UseShellExecute = false;

                    MinerProcess.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;

                    MinerProcess.StartInfo.RedirectStandardError = true;
                    MinerProcess.StartInfo.RedirectStandardOutput = true;
                    MinerProcess.StartInfo.RedirectStandardInput = true;

                    MinerProcess.OutputDataReceived += (origin, args) => IntermediateStandardWriter(args.Data);
                    MinerProcess.ErrorDataReceived += (origin, args) => IntermediateErrorWriter(args.Data);

                    MinerProcess.Start();

                    MinerProcess.BeginOutputReadLine();
                    MinerProcess.BeginErrorReadLine();

As you can see, C# takes care of reading from pipes and redirecting Data to a programmer-defined delegate method. No peeking is allowed. Cheesy

Your explanation actually casts light on why I needed to add "-l 1" to cgminer - the output comes within the first second, so there's something to read from the pipe. With higher values, the pipe remains empty for longer, so reading from it gets blocked.

Can't promise anything, but if I get time, I'll try to resolve the issue, following your lead.
Pages:
Jump to: