This is an automated email from the ASF dual-hosted git repository.
dimuthuupe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-mft.git
The following commit(s) were added to refs/heads/master by this push:
new f4e2bd9 Update and log commands for mft-cli
f4e2bd9 is described below
commit f4e2bd953b343cce2f2e1a7c5b4af2eb3e501851
Author: DImuthuUpe <[email protected]>
AuthorDate: Tue Mar 21 09:25:18 2023 -0400
Update and log commands for mft-cli
---
python-cli/mft_cli/airavata_mft_cli/base.py | 10 ++++++-
python-cli/mft_cli/airavata_mft_cli/bootstrap.py | 33 +++++++++++++++++++++-
python-cli/mft_cli/pyproject.toml | 2 +-
.../assembly/standalone-service-bin-assembly.xml | 7 +++++
.../src/main/resources/application.properties | 3 +-
.../distribution/conf/application.properties | 5 ++--
6 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/python-cli/mft_cli/airavata_mft_cli/base.py
b/python-cli/mft_cli/airavata_mft_cli/base.py
index 9cdf4d5..4e9a6a8 100644
--- a/python-cli/mft_cli/airavata_mft_cli/base.py
+++ b/python-cli/mft_cli/airavata_mft_cli/base.py
@@ -36,4 +36,12 @@ def init_mft():
@app.command("stop")
def init_mft():
- bootstrap.stop_mft()
\ No newline at end of file
+ bootstrap.stop_mft()
+
[email protected]("update")
+def init_mft():
+ bootstrap.update_mft()
+
[email protected]("log")
+def init_mft():
+ bootstrap.print_log()
\ No newline at end of file
diff --git a/python-cli/mft_cli/airavata_mft_cli/bootstrap.py
b/python-cli/mft_cli/airavata_mft_cli/bootstrap.py
index e6e9b9e..9e78be6 100644
--- a/python-cli/mft_cli/airavata_mft_cli/bootstrap.py
+++ b/python-cli/mft_cli/airavata_mft_cli/bootstrap.py
@@ -24,6 +24,8 @@ from subprocess import call
from subprocess import Popen
from pathlib import Path
from sys import platform
+import shutil
+import time
def download_and_unarchive(url, download_path, extract_dir =
os.path.join(os.path.expanduser('~'), ".mft/")):
@@ -117,7 +119,7 @@ def start_mft():
def stop_mft():
- print("Stopping up MFT Services")
+ print("Stopping MFT Services")
path = os.path.join(os.path.expanduser('~'), ".mft/consul")
if os.path.exists(path):
@@ -138,6 +140,35 @@ def stop_mft():
print("MFT Stopped....")
+def update_mft():
+ stop_mft()
+ mft_dir = os.path.join(os.path.expanduser('~'), ".mft")
+ if os.path.exists(mft_dir):
+ print("Removing .mft directory")
+ shutil.rmtree(mft_dir)
+
+ database = os.path.join(os.path.expanduser('~'), "mft_db.mv.db")
+ if os.path.exists(database):
+ os.remove(database)
+ start_mft()
+
+def print_log():
+ log_file_path = os.path.join(os.path.expanduser('~'), ".mft",
"Standalone-Service-0.01", "logs", "airavata.log")
+ log_file = open(log_file_path,"r")
+ lines = follow_file(log_file)
+ for line in lines:
+ print(line)
+
+def follow_file(file):
+ #file.seek(0, os.SEEK_END)
+
+ while True:
+ line = file.readline()
+ if not line:
+ time.sleep(0.1)
+ continue
+
+ yield line
diff --git a/python-cli/mft_cli/pyproject.toml
b/python-cli/mft_cli/pyproject.toml
index 06d4809..a6d8acd 100644
--- a/python-cli/mft_cli/pyproject.toml
+++ b/python-cli/mft_cli/pyproject.toml
@@ -18,7 +18,7 @@
[tool.poetry]
name = "airavata-mft-cli"
-version = "0.1.8"
+version = "0.1.9"
description = "Command Line Client for Airavata MFT data transfer software"
authors = ["Apache Airavata <[email protected]>"]
readme = "README.md"
diff --git
a/standalone-service/src/main/assembly/standalone-service-bin-assembly.xml
b/standalone-service/src/main/assembly/standalone-service-bin-assembly.xml
index ee64c7a..731ef4f 100644
--- a/standalone-service/src/main/assembly/standalone-service-bin-assembly.xml
+++ b/standalone-service/src/main/assembly/standalone-service-bin-assembly.xml
@@ -52,6 +52,13 @@
<include>*.sh</include>
</includes>
</fileSet>
+ <fileSet>
+ <directory>../plugins</directory>
+ <outputDirectory>plugins</outputDirectory>
+ <includes>
+ <include>*.zip</include>
+ </includes>
+ </fileSet>
<fileSet>
<directory>src/main/resources/distribution/conf</directory>
<outputDirectory>conf</outputDirectory>
diff --git a/standalone-service/src/main/resources/application.properties
b/standalone-service/src/main/resources/application.properties
index 629d6f3..8d208ad 100644
--- a/standalone-service/src/main/resources/application.properties
+++ b/standalone-service/src/main/resources/application.properties
@@ -25,4 +25,5 @@ resource.service.host=localhost
resource.service.port=7003
secret.service.host=localhost
secret.service.port=7003
-agent.id=local-agent
\ No newline at end of file
+agent.id=local-agent
+agent.transport.directory=plugins
\ No newline at end of file
diff --git
a/standalone-service/src/main/resources/distribution/conf/application.properties
b/standalone-service/src/main/resources/distribution/conf/application.properties
index e22d45d..91a37e7 100644
---
a/standalone-service/src/main/resources/distribution/conf/application.properties
+++
b/standalone-service/src/main/resources/distribution/conf/application.properties
@@ -16,7 +16,7 @@
#
spring.main.allow-bean-definition-overriding=true
-spring.datasource.url=jdbc:h2:~/mft_db;DB_CLOSE_ON_EXIT=FALSE;IFEXISTS=TRUE;DB_CLOSE_DELAY=-1;
+spring.datasource.url=jdbc:h2:~/mft_db;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1;
spring.jpa.hibernate.ddl-auto=update
consul.host=localhost
@@ -25,4 +25,5 @@ resource.service.host=localhost
resource.service.port=7003
secret.service.host=localhost
secret.service.port=7003
-agent.id=local-agent
\ No newline at end of file
+agent.id=local-agent
+agent.transport.directory=${AIRAVATA_HOME}/plugins
\ No newline at end of file