diff --git a/.gitignore b/.gitignore index 9f824df..24b0a35 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,6 @@ config.json .vscode/ #ignore generated iptables -p2p/iptable/ \ No newline at end of file +p2p/iptable/ +#ignore plugins added +plugin/deploy \ No newline at end of file diff --git a/config/config.go b/config/config.go index c7d54fe..9ce4789 100644 --- a/config/config.go +++ b/config/config.go @@ -26,6 +26,7 @@ type Config struct { DefaultDockerFile string SpeedTestFile string IPV6Address string + PluginPath string //NetworkInterface string //NetworkInterfaceIPV6Index int } @@ -86,6 +87,7 @@ func SetDefaults() error { defaults["DockerContainers"] = defaultPath + "server/docker/containers/" defaults["SpeedTestFile"] = defaultPath + "p2p/50.bin" defaults["IPV6Address"] = "" + defaults["PluginPath"] = defaultPath + "plugin/deploy" //defaults["NetworkInterface"] = "wlp0s20f3" //defaults["NetworkInterfaceIPV6Index"] = "2" diff --git a/deploy/roles/rsync/tasks/main.yml b/deploy/roles/rsync/tasks/main.yml index 622e435..211ade0 100644 --- a/deploy/roles/rsync/tasks/main.yml +++ b/deploy/roles/rsync/tasks/main.yml @@ -15,8 +15,8 @@ state: started when: inventory_hostname == rsync.master -# Synchronize the data folder across hosts -- name: synchronize the data folder +# Synchronize the data deploy across hosts +- name: synchronize the data deploy delegate_to: "{{ rsync.master }}" synchronize: src: "{{ sync.source }}" diff --git a/main.go b/main.go index 2d5718d..69e850a 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( ) // VERSION specifies the version of the platform -var VERSION = "1.0.0" +var VERSION = "beta-1.0.0" var mode string // Varaibles if mode is client diff --git a/plugin/deploy/.gitkeep b/plugin/deploy/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/plugin/plugin.go b/plugin/plugin.go new file mode 100644 index 0000000..74d3f5a --- /dev/null +++ b/plugin/plugin.go @@ -0,0 +1,54 @@ +package plugin + +import ( + "git.sr.ht/~akilan1999/p2p-rendering-computation/config" + "io/ioutil" +) + +// Plugins Array of all plugins detected +type Plugins struct { + PluginsDetected []*Plugin +} + +// Plugin Information about the plugins available +type Plugin struct { + FolderName string + PluginDescription string +} + +// DetectPlugins Detects all the plugins available +func DetectPlugins()(*Plugins,error){ + config, err:= config.ConfigInit() + if err != nil { + return nil,err + } + folders, err := ioutil.ReadDir(config.PluginPath) + if err != nil { + return nil, err + } + + var plugins *Plugins = new(Plugins) + + for _, f := range folders { + if f.IsDir() { + //Declare variable plugin of type Plugin + var plugin Plugin + + // Setting name of folder to plugin + plugin.FolderName = f.Name() + // Getting Description from file description.txt + Description, err := ioutil.ReadFile(config.PluginPath + "/" + plugin.FolderName + "/description.txt") + // if we os.Open returns an error then handle it + if err != nil { + return nil, err + } + + // Get Description from description.txt + plugin.PluginDescription = string(Description) + + plugins.PluginsDetected = append(plugins.PluginsDetected, &plugin) + } + } + + return plugins,nil +} \ No newline at end of file diff --git a/sample-run/tensorflow/roles/rsync/tasks/main.yml b/sample-run/tensorflow/roles/rsync/tasks/main.yml index 622e435..211ade0 100644 --- a/sample-run/tensorflow/roles/rsync/tasks/main.yml +++ b/sample-run/tensorflow/roles/rsync/tasks/main.yml @@ -15,8 +15,8 @@ state: started when: inventory_hostname == rsync.master -# Synchronize the data folder across hosts -- name: synchronize the data folder +# Synchronize the data deploy across hosts +- name: synchronize the data deploy delegate_to: "{{ rsync.master }}" synchronize: src: "{{ sync.source }}" diff --git a/server/docker/docker.go b/server/docker/docker.go index 061283d..3a69429 100644 --- a/server/docker/docker.go +++ b/server/docker/docker.go @@ -137,7 +137,7 @@ func BuildRunContainer(NumPorts int, GPU string, ContainerName string) (*DockerV } -//Builds docker image (TODO: relative path for Dockerfile folder) +//Builds docker image (TODO: relative path for Dockerfile deploy) func (d *DockerVM)imageBuild(dockerClient *client.Client) error { ctx, _ := context.WithTimeout(context.Background(), time.Second*2000) //defer cancel() @@ -298,7 +298,7 @@ func StopAndRemoveContainer(containername string) error { // ViewAllContainers returns all containers runnable and which can be built func ViewAllContainers() (*DockerContainers, error){ - // Traverse the folder path as per given in the config file + // Traverse the deploy path as per given in the config file config, err := config.ConfigInit() if err != nil { return nil,err @@ -317,7 +317,7 @@ func ViewAllContainers() (*DockerContainers, error){ //Declare variable DockerContainer of type struct var Container DockerContainer - // Setting container name to folder name + // Setting container name to deploy name Container.ContainerName = f.Name() // Getting Description from file description.txt Description, err := ioutil.ReadFile(config.DockerContainers + "/" + Container.ContainerName + "/description.txt")