You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@slider.apache.org by "fengyongshe (JIRA)" <ji...@apache.org> on 2015/12/19 11:40:46 UTC

[jira] [Comment Edited] (SLIDER-664) Add support for custom commands through the agent

    [ https://issues.apache.org/jira/browse/SLIDER-664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15065331#comment-15065331 ] 

fengyongshe edited comment on SLIDER-664 at 12/19/15 10:40 AM:
---------------------------------------------------------------

Here is some test
1)deploy tomcat servers in yarn containers
    https://issues.apache.org/jira/browse/SLIDER-809
2) add the upload function into the tomcat.py script,upload war file to {tomcat-dir}/webapps
  eg:
     def uploadfile(self,env):
    import params
    #Don't need to re-call configure
    env.set_params(params)
    upload_cmd = format('hdfs dfs -copyToLocal {upload_app_file} {app_root}/apache-tomcat-7.0.62/webapps/')
    os.system(upload_cmd)
    copy_cmd = format('hdfs dfs -cp {upload_app_file} {tomcat_app_dir}/')
    os.system(copy_cmd)

3) execute the custorm command ,eg:
slider operate demo-tomcat --cmd UPLOADFILE --containers container_1449127000251_0043_01_000002 --components TOMCAT -D site.global.hdfs_upload_file=/data/app.war

4) the app.war  in hdfs are copied to {woriking-dir}/webapps
[root@xx webapps]# ls
app.war  docs  examples  host-manager  manager  ROOT





was (Author: fengyongshe):
Here is some test
1)deploy tomcat servers in yarn containers
    https://issues.apache.org/jira/browse/SLIDER-809
2) add command to upload war file to tomcat server {working dir}/webapps
    add the upload function into the tomcat.py script
  eg:
     def uploadfile(self,env):
    import params
    #Don't need to re-call configure
    env.set_params(params)
    upload_cmd = format('hdfs dfs -copyToLocal {upload_app_file} {app_root}/apache-tomcat-7.0.62/webapps/')
    os.system(upload_cmd)
    copy_cmd = format('hdfs dfs -cp {upload_app_file} {tomcat_app_dir}/')
    os.system(copy_cmd)

3) execute the custorm command ,eg:
slider operate demo-tomcat --cmd UPLOADFILE --containers container_1449127000251_0043_01_000002 --components TOMCAT -D site.global.hdfs_upload_file=/data/app.war

4) the app.war  in hdfs are copied to {woriking-dir}/webapps
[root@xx webapps]# ls
app.war  docs  examples  host-manager  manager  ROOT




> Add support for custom commands through the agent
> -------------------------------------------------
>
>                 Key: SLIDER-664
>                 URL: https://issues.apache.org/jira/browse/SLIDER-664
>             Project: Slider
>          Issue Type: Improvement
>          Components: agent, agent-provider, app-package
>    Affects Versions: Slider 0.60
>            Reporter: Sumit Mohanty
>            Assignee: Sumit Mohanty
>            Priority: Critical
>
> Slider application package allows defining of arbitrary commands. However, there is no way to execute these arbitrary commands using the Slider command line. A basic approach can be as follows:
> * App developer defines a custom command say "COMMAND" and a python function is mapped to this command in the same way as "START" or "INSTALL".
> * Using Slider-Agent the command can be issued against specific containers identified by the container id
> * While issuing commands, optional properties (name-value pairs) may be provided
> * Once command is issued a command id is returned that can be used to retrieve the command result
> * Command execution or the result is not persisted by Slider - so it is a best effort execution



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)