Exemplo n.º 1
0
    def test_output_oss_artifact(self):
        # the content of local file would be uploaded to OSS
        output_artifact = couler.create_oss_artifact(
            path="/home/t1.txt",
            bucket="test-bucket/",
            accesskey_id="abcde",
            accesskey_secret="abc12345",
            key="osspath/t1",
            endpoint="xyz.com",
        )
        couler.run_container(
            image="docker/whalesay:latest",
            args=["echo -n hello world > %s" % output_artifact.path],
            command=["bash", "-c"],
            output=output_artifact,
        )
        proto_wf = get_default_proto_workflow()
        s = proto_wf.steps[0].steps[0]
        t = proto_wf.templates[s.tmpl_name]
        self.assertEqual(s.container_spec.image, "docker/whalesay:latest")
        self.assertTrue(t.outputs[0].artifact.name.startswith("output-oss"))
        self.assertEqual(t.outputs[0].artifact.local_path, "/home/t1.txt")
        self.assertEqual(t.outputs[0].artifact.endpoint, "xyz.com")
        self.assertEqual(t.outputs[0].artifact.bucket, "test-bucket/")

        self.assertEqual(t.outputs[0].artifact.access_key.key, "accessKey")
        proto_sk = t.outputs[0].artifact.secret_key
        self.assertEqual(proto_sk.key, "secretKey")
        self.assertEqual(proto_sk.value,
                         states._secrets[proto_sk.name].data[proto_sk.key])
Exemplo n.º 2
0
        def producer():
            output_artifact = couler.create_oss_artifact(
                path="/mnt/t1.txt",
                bucket="test-bucket/",
                accesskey_id="abcde",
                accesskey_secret="abc12345",
                key="osspath/t1",
                endpoint="xyz.com",
            )

            outputs = couler.run_container(
                image="docker/whalesay:latest",
                args=["echo -n hello world > %s" % output_artifact.path],
                command=["bash", "-c"],
                output=output_artifact,
            )

            return outputs
Exemplo n.º 3
0
 def test_output_oss_artifact(self):
     # the content of local file would be uploaded to OSS
     output_artifact = couler.create_oss_artifact(
         path="/home/t1.txt",
         bucket="test-bucket/",
         accesskey_id="abcde",
         accesskey_secret="abc12345",
         key="osspath/t1",
         endpoint="xyz.com",
     )
     couler.run_container(
         image="docker/whalesay:latest",
         args=["echo -n hello world > %s" % output_artifact.path],
         command=["bash", "-c"],
         output=output_artifact,
     )
     proto_wf = get_default_proto_workflow()
     s = proto_wf.steps[0]
     self.assertEqual(s.container_spec.image, "docker/whalesay:latest")
     self.assertTrue(s.outputs[0].artifact.name.startswith("output-oss"))
Exemplo n.º 4
0
    def test_output_oss_artifact(self):
        # the content of local file would be uploaded to OSS
        output_artifact = couler.create_oss_artifact(
            path="/mnt/t1.txt",
            bucket="test-bucket/",
            accesskey_id="abcde",
            accesskey_secret="abc12345",
            key="osspath/t1",
            endpoint="xyz.com",
        )
        couler.run_container(
            image="docker/whalesay:latest",
            args=["echo -n hello world > %s" % output_artifact.path],
            command=["bash", "-c"],
            output=output_artifact,
        )

        wf = couler.workflow_yaml()
        template = wf["spec"]["templates"][1]
        artifact = template["outputs"]["artifacts"][0]
        self._oss_check_helper(artifact)
        couler._cleanup()
Exemplo n.º 5
0
    def test_input_oss_artifact(self):
        input_artifact = couler.create_oss_artifact(
            path="/mnt/t1.txt",
            bucket="test-bucket/",
            accesskey_id="abcde",
            accesskey_secret="abc12345",
            key="osspath/t1",
            endpoint="xyz.com",
        )

        # read the content from an OSS bucket
        couler.run_container(
            image="docker/whalesay:latest",
            args=["cat %s" % input_artifact.path],
            command=["bash", "-c"],
            input=input_artifact,
        )

        wf = couler.workflow_yaml()
        template = wf["spec"]["templates"][1]
        artifact = template["inputs"]["artifacts"][0]
        self._oss_check_helper(artifact)
        couler._cleanup()