# execution ordering. A dag_t requires that you have files and that # doesn't help for things that are not file oriented. import os import sys import find import mbuild env = mbuild.env_t() env.parse_args() work_queue = mbuild.work_queue_t(env['jobs']) last_command_in_sequence = {} for i in range(0, 99): cmd = "/bin/echo %d" % (i) c = mbuild.command_t(cmd) # break the commmands in to 7 sequences seq = i % 7 # enforce a dependence between commands in the same sequence try: prev = last_command_in_sequence[seq] prev.add_after_me(c) except: pass last_command_in_sequence[seq] = c mbuild.msgb('ADDING', i) # add it to the work queue work_queue.add(c)
# See the License for the specific language governing permissions and # limitations under the License. # #END_LEGAL import os, sys sys.path = ['..'] + sys.path import mbuild env = mbuild.env_t() env.parse_args() env['jobs'] = 1 work_queue = mbuild.work_queue_t(env['jobs']) all_cmds = ['python -c "1+1"'] subs = {} command_list = [] for cmd in all_cmds: cmd = cmd % (subs) mbuild.msgb('ADDING', cmd) c = mbuild.command_t(cmd, output_file_name="foo") work_queue.add(c) command_list.append(cmd) phase = "BUILD" okay = work_queue.build() if not okay: mbuild.die("[%s] failed. dying..." % phase) mbuild.msgb(phase, "succeeded")
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #END_LEGAL import find import mbuild env = mbuild.env_t(0) env.parse_args() work_queue = mbuild.work_queue_t(env['jobs']) c = mbuild.command_t("/bin/sleep 1", seconds=2, show_output=False) #work_queue.add(c) c2 = mbuild.command_t("./spew", seconds=2, show_output=False) #work_queue.add(c2) def some_python_fn(a, b): n = 10 x = 0 for i in range(0, n): for j in range(0, n): for k in range(0, n): x += i * j * k return (0, [str(x)], [])