adding jobs while running

General
baigner
2011-12-14
2013-05-28
  • baigner

    baigner - 2011-12-14

    hey,

    i am completely new to oddjob but as far as i learned its a great software with many features that make job scheduling very easy. however it seems to me that i dont even need all those features for what i want to do.
    here is my problem: i want to create a job chain that runs executables from the computer. so far its not that complicated because i can just do it by building a sequentialJob and add the execJobs within this sequential… but i need to know if there is a way to add execJobs while the others are already running. this is the only thing i need to be done. very simple problem but so far i havent found any solve…

    Thank you!

    PS: maybe if oddjob does not support this kind of request do you know an alternative software that can do what i want? simply spoken i just need something that batches the executable jobs just like the printer does in a print queue.

     
  • Rob Gordon

    Rob Gordon - 2011-12-14

    How do you want to add the jobs? Do you want to do this programatically? What will be generating the jobs?

    I think that Oddjob could quite easily support being a job server that took jobs from a queue by using the foreach job. The foreach job just reads from an Iterable and something could be written that provided an Iterable of commands that could block until another job arrived. Might this be the sort of thing you want?

    Unfortunately I don't know of anything else that would do this out of the box.

    Rob.

     
  • baigner

    baigner - 2011-12-14

    the jobs are either batch files or .exe files that mostly take all of the CPU's capacity and therefore cant run parallel. so i just want to be able to add a .exe file manually while the previous is running so that it starts automatically when the previous is done…

    like i said i am new to oddjob and all i am looking for is a program that qeues .exe files or batch files.

    When i want to print a document while something else is already being printed it automatically lines up in a qeue… can oddjob do that for me with executables too? or do you know any software that can?

    i have been looking for that kind of software for a long time now and havent found anything that helps me yet…

     
  • henyo

    henyo - 2011-12-15

    I do not know what you want , could you give an example ?

     
  • baigner

    baigner - 2011-12-15

    i can try,,, :)
    i have to deal with aircraft design and i need several calculations to be done. those are generated by several .exe files on the computer. the problem is that each calculation takes up almost all of the cpu so that you can only run one at a time. often those calculations last many hours. so right now if i want a second calculation to be done after the first i have to wait until the first is done. what i need is a software were i can easily add jobs that start automatically after the previous is done…

    like i said  just like it is done when you add print jobs to your print queue only with .exe files.

     
  • Rob Gordon

    Rob Gordon - 2011-12-15

    If you know in advance what the jobs are you can use foreach. Provide the exec commands as a list of values and then the foreach configuraton would be the exec job that used the loops current value as the command to run.

    I've been experimenting with some code that will allow Oddjob to run as a more adhoc job queue. I should be able to get something committed later today.

     
  • baigner

    baigner - 2011-12-15

    thank you. :)
    thats the big problem… i dont know in advance what the jobs exactly are because i am not the only user of the computer. it has to be possible for others to add their jobs while mine are running.

     
  • Rob Gordon

    Rob Gordon - 2011-12-15

    I've written a very simple implementation of a blocking queue of values that will work with a foreach job to implement a job queue. I've uploaded the code and binary to the snapshots directory.

    Here's the configuration for the server:

    <oddjob>
        <job>
            <sequential>
                <jobs>
                    <rmireg/>
                    <jmx:server name="Management MBean Server" root="${jobs}" url="service:jmx:rmi://ignored/jndi/rmi://localhost/my-queue-server" xmlns:jmx="http://rgordon.co.uk/oddjob/jmx"/>
                    <sequential id="jobs">
                        <jobs>
                            <bean class="org.oddjob.values.ValueQueueService" id="queue"/>
                            <foreach id="foreach" preLoad="1" purgeAfter="10">
                                <values>
                                    <value value="${queue.values}"/>
                                </values>
                                <configuration>
                                    <xml>
                                        <foreach id="loop">
                                            <job>
                                                <echo name="Echo ${loop.current}"><![CDATA]></echo>
                                            </job>
                                        </foreach>
                                    </xml>
                                </configuration>
                            </foreach>
                        </jobs>
                    </sequential>
                </jobs>
            </sequential>
        </job>
    </oddjob>

    At the moment the server will just echo every bit of text sent to it but the foreach can be configured to do whatever you want with the text - i.e execute it. Here's a client that will submit some text to the queue.

    <oddjob id="this">
        <job>
            <sequential>
                <jobs>
                    <state:if xmlns:state="http://rgordon.co.uk/oddjob/state">
                        <jobs>
                            <check name="Check Argument Provided" value="${this.args}"/>
                            <properties>
                                <values>
                                    <value key="value.to.queue" value="${this.args}"/>
                                </values>
                            </properties>
                            <input>
                                <requests>
                                    <input-text prompt="Value To Queue" property="value.to.queue"/>
                                </requests>
                            </input>
                        </jobs>
                    </state:if>
                    <jmx:client id="remote" url="service:jmx:rmi:///jndi/rmi://localhost/my-queue-server" xmlns:jmx="http://rgordon.co.uk/oddjob/jmx"/>
                    <echo><![CDATA]></echo>
                    <set name="Add Value To Job Queue">
                        <values>
                            <value key="remote/queue.value" value="${value.to.queue}"/>
                        </values>
                    </set>
                    <stop job="${remote}"/>
                </jobs>
            </sequential>
        </job>
    </oddjob>

    If this is the kind of thing you want I will put a bit more thought into improving it.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks