Exemple #1
0
    def test_echo(self):
        a = FileDROP('a', 'a')
        b = BashShellApp('b', 'b', command='cp %i0 %o0')
        c = FileDROP('c', 'c')

        b.addInput(a)
        b.addOutput(c)

        # Random data so we always check different contents
        data = ''.join([random.choice(string.ascii_letters + string.digits) for _ in xrange(10)])
        with DROPWaiterCtx(self, c, 100):
            a.write(data)
            a.setCompleted()

        self.assertEquals(data, droputils.allDropContents(c))

        # We own the file, not root
        uid = os.getuid()
        self.assertEquals(uid, os.stat(c.path).st_uid)
Exemple #2
0
    def test_echo(self):
        a = FileDROP('a', 'a')
        b = BashShellApp('b', 'b', command='cp %i0 %o0')
        c = FileDROP('c', 'c')

        b.addInput(a)
        b.addOutput(c)

        # Random data so we always check different contents
        data = os.urandom(10)
        with DROPWaiterCtx(self, c, 100):
            a.write(data)
            a.setCompleted()

        self.assertEqual(data, droputils.allDropContents(c))

        # We own the file, not root
        uid = os.getuid()
        self.assertEqual(uid, os.stat(c.path).st_uid)
Exemple #3
0
column = 'data'
row = 0
rows = 1

# Create the Drops
a = ShoreDROP(doid, doid, doid=doid, column=column, row=row, rows=rows)
b = BashShellApp('b', 'b', command="echo hello")
c = ShoreDROP(doid,
              doid,
              doid=doid,
              column='processed_data',
              row=row,
              rows=rows)

# Wire them together
b.addInput(a)
b.addOutput(c)

# The execution is asyncrhonously triggered by setCompleted()
# so we need to wait on an event that will be set when C moves to COMPLETED
# (or ERROR)
finished = threading.Event()
c.subscribe(EvtConsumer(finished), 'status')

# Fire and wait

rows = 1
xdim = 5
ydim = 10
data = np.ndarray([rows, xdim, ydim])
for r in range(rows):