[
https://issues.apache.org/jira/browse/BEAM-12988?focusedWorklogId=660525&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-660525
]
ASF GitHub Bot logged work on BEAM-12988:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 05/Oct/21 19:21
Start Date: 05/Oct/21 19:21
Worklog Time Spent: 10m
Work Description: damondouglas commented on a change in pull request
#15645:
URL: https://github.com/apache/beam/pull/15645#discussion_r722513958
##########
File path: playground/backend/internal/fs_tool/fs_test.go
##########
@@ -0,0 +1,49 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// 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.
+
+package fs_tool
+
+import (
+ pb "beam.apache.org/playground/backend/internal/api"
Review comment:
@pabloem FYI I don't think this is a blocker but the code for
playground/backend/internal/api is not part of this PR. It's a simple enough
test that I'm ok moving forward and trusting everything will come together in
time.
##########
File path: playground/backend/internal/fs_tool/fs.go
##########
@@ -0,0 +1,57 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// 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.
+
+package fs_tool
+
+import (
+ pb "beam.apache.org/playground/backend/internal/api"
+ "fmt"
+ "github.com/google/uuid"
+)
+
+// FileSystemService interface for all type(Java/Go/Python/Scio) of FileSystem
services.
+type FileSystemService interface {
Review comment:
May we consider breaking up this interface to follow more of the typical
interface to method 1:1 carnality we see with go? Brainstorming out loud, what
do we think about the following? The following isn't complete but just a
conversation starter. I removed the `bool` from the return signatures as it
could be part of the error.
```
import "io/fs"
type Setup interface {
Create() (fs.FS, error)
}
type Teardown interface {
Delete() error
}
type LifeCycle struct {
sdk pb.Sdk
root fs.FS
folderGlobs []string
}
func New(ctx context.Context, sdk pb.Sdk) (*LifeCycle, error) {
switch sdk {
case pb.Sdk_SDK_JAVA:
return &LifeCycle{
sdk: sdk,
root: javaFS, // See java_fs.go
folderGlobs: javaGlobs,
}, nil
default:
return nil, fmt.Errorf("%s isn't supported now", sdk)
}
}
func (lc *LifeCycle) Create() (fs.FS, error) {
for _, k := range lc.folderGlobs {
if err := MkdirAll( ... ); err != nil {
...
}
}
}
func (lc *LifeCycle) Delete() error {
....
}
```
##########
File path: playground/backend/internal/fs_tool/java_fs.go
##########
@@ -0,0 +1,140 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// 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.
+
+package fs_tool
+
+import (
+ "fmt"
+ "github.com/google/uuid"
+ "io/fs"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+)
+
+const (
+ parentBaseFileFolder = "internal"
+ javaBaseFileFolder = parentBaseFileFolder + "/executable_files"
+ javaSrcFileFolder = javaBaseFileFolder + "/src"
+ javaBinFileFolder = javaBaseFileFolder + "/bin"
+ javaExecutableFileType = "java"
+ javaCompiledFileType = "class"
+)
+
Review comment:
In addition to comments on the interface in
playground/backend/internal/fs_tool/fs.go:
```
var (
javaGlobs = []string{
parentBaseFileFolder,
javaBaseFileFolder,
javaSrcFileFolder,
javaBinFileFolder,
}
javaFs = os.DirFS(parentBaseFileFolder)
)
```
##########
File path: playground/backend/internal/fs_tool/java_fs.go
##########
@@ -0,0 +1,140 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// 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.
+
+package fs_tool
+
+import (
+ "fmt"
+ "github.com/google/uuid"
+ "io/fs"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+)
+
+const (
+ parentBaseFileFolder = "internal"
+ javaBaseFileFolder = parentBaseFileFolder + "/executable_files"
+ javaSrcFileFolder = javaBaseFileFolder + "/src"
+ javaBinFileFolder = javaBaseFileFolder + "/bin"
+ javaExecutableFileType = "java"
+ javaCompiledFileType = "class"
+)
+
+type JavaFileSystemService struct{}
Review comment:
The comments above may remove the need for a specific
JavaFileSystemService struct.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 660525)
Time Spent: 1h (was: 50m)
> Implement FileSystem service
> ----------------------------
>
> Key: BEAM-12988
> URL: https://issues.apache.org/jira/browse/BEAM-12988
> Project: Beam
> Issue Type: Sub-task
> Components: beam-playground
> Reporter: Ilya Kozyrev
> Assignee: Aydar Zaynutdinov
> Priority: P3
> Time Spent: 1h
> Remaining Estimate: 0h
>
> We need to have a go module that helps us to communicate with the file system.
>
> Server and controller take code as a string, but executor requires the
> prepared folder structure on fs and Java code located in the file. For this
> purpose, we need to implement an additional module that will be responsible
> for that.
> This module should have the following functionality:
> * Take SDK in the constructor and be able to manage functionality depends on
> SDK.
> * Create directory structure on fs for specific SDK. This structure will use
> for compilation and running code.
> * Write Java code from string to file on FS
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)