Skip to content

Commit

Permalink
update to 0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sulstice committed Dec 21, 2020
1 parent adcf115 commit 1bd2397
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 16 deletions.
83 changes: 77 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,100 @@
LogReader: A logreader function to read your files!
===================================================
GroLogs: A log reader for the software GROMACS
==============================================

![Python](https://img.shields.io/badge/python-3.6-blue.svg)
[![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/)
[![saythanks](https://img.shields.io/badge/GROMACS-5.1-ff69b3.svg)](https://www.computchem.org/)
[![saythanks](https://img.shields.io/badge/Lab-Shen%20Group-ff69b4.svg)](https://www.computchem.org/)

GroLogs was started out of a need to quickly check thet status update of molecular dynamic simulations using GROMACS. By
reading the log files and the steps within the log files we can calculate the time in nanoseconds of the simulation using
this simple formula

```
nanoseconds = steps / 500,000
```

and output to a beautiful table.

Quick Start
===========

First you will need authentication to the cluster or server running the Molecular Dynamics simulation for GROMACS.

First is simple

1. Register your RSA key with the dedicated server so you don't have to be password prompted when SSH'ing into the server

`GroLogs` class takes 4 arguments

- **target_directory** - target directory where all your log files for this particular experiment will be
- **log_file_name** - the name of the log file. Traditionally, I have everything called as `md_3.log`
- **username** - the username registered on the cluster or particular machine
- **hostname** - the hostname or ip address of the target server that we want to extrapolate information.

Initialize the class like so:

```
log_reader = GroLogs('target_directory/*', 'md_3.log', username, hostname)
```

and then generate a table to output the results

```
log_reader.generate_table()
```

and here is an example of the output:

```
+-------------------------------------------------------+----------+-----------+
| --- File Path --- | Step | Time (ns) |
+-------------------------------------------------------+----------+-----------+
| file/path/to/experiment/trial_2/ | 60947999 | 121.896 |
+-------------------------------------------------------+----------+-----------+
| file/path/to/experiment/trial_3/ | 68454999 | 136.91 |
+-------------------------------------------------------+----------+-----------+
| file/path/to/experiment/trial_3/ | 28107999 | 56.216 |
+-------------------------------------------------------+----------+-----------+
```


Announcements
=============

- Work has began! Dec 4th
- 0.0.1 version released Dec 4th LogReader
- 0.0.2 version released -> authentication can be passed in and name changed to GroLogs, more documentation!

Installation
============

LogReader is going to be distribute via PyPi and as the content store grows we can expand it to other pieces of software
GroLogs is going to be distribute via PyPi and as the content store grows we can expand it to other pieces of software
making it accessible to all regardless of what you use. Alternatively, you could have a glance at the source code and copy/paste
it yourself.

To install the reader

```
python -m pip install grologs
```

Structure of LogReader
Structure ofGroLogs
=======================

Currently, the main subpackages are:

- **logreader**: logreader main class.
- **grologs**: logreader main class.


Genesis
Expand All @@ -32,7 +103,7 @@ Genesis
LogReader was created because I noticed I was using the same variable across multiple scripts and figure it would be useful
for folk to have.

- Lead Developer [Suliman sharif](http://sulstice.github.io/)
- Lead Developer [Suliman Sharif](http://sulstice.github.io/)


* * * * *
Expand Down
4 changes: 2 additions & 2 deletions logreader/__init__.py → grologs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#
# ----------------------------

from logreader.logreader import LogReader
from grologs.grologs import GroLogs

name='LogReader'
name='grologs'
17 changes: 13 additions & 4 deletions logreader/logreader.py → grologs/grologs.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
# Authentication to Apollo

class LogReader(object):
class GroLogs(object):

__version__ = '0.0.1'

def __init__(self, target_directory, target_log):
def __init__(self, target_directory, target_log, username = None, hostname = None):

'''
Initialize to find the target logs and readers
'''
self.user, self.hostname = self._read_authentication()

if username == None and hostname == None:
self.user, self.hostname = self._read_authentication()
else:
self.user = username
self.hostname = hostname

self.target_directory = target_directory
self.target_log = target_log
self.timings = {}
self._read_loggers()


def _read_authentication(self):


Expand Down Expand Up @@ -71,6 +75,10 @@ def _read_loggers(self):

stdout_stream = portal.run('tail -n 13 ' + file_path + '', hide=True)
stdout = stdout_stream.stdout.strip().split('\n')[0].split('vol')[0].strip().split(' ')[-1]

if str(stdout) == '0.0':
stdout = 'Completed'

self.timings[file_path] = stdout

def generate_table(self):
Expand All @@ -97,3 +105,4 @@ def generate_table(self):
table.append_row(row)

print(table)

8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
if os.path.exists('README.md'):
long_description = open('README.md').read()
else:
long_description = 'LogReader- A quick utility tool for reading log files'
long_description = 'GroLogs - A log reader for GROMACS log files'

TEST_REQUIREMENTS = [
'pytest',
Expand All @@ -35,9 +35,9 @@
# exec
# ----
setup(
name="logreader",
version="0.0.1",
packages=['logreader'],
name="grologs",
version="0.0.2",
packages=['grologs'],
license='MIT',
author="Suliman Sharif",
author_email="sharifsuliman1@gmail.com",
Expand Down

0 comments on commit 1bd2397

Please sign in to comment.