File tree Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -11,3 +11,12 @@ Shell.
11
11
12
12
_ Note:_ This repository is a public mirror, pull requests will not be accepted.
13
13
Please file an issue if you have a feature or bug request.
14
+
15
+ ## Running Models
16
+
17
+ To run models in the ` models ` subdirectory, you may need to add the top-level
18
+ ` /models ` folder to the Python path with the command:
19
+
20
+ ```
21
+ export PYTHONPATH="$PYTHONPATH:/path/to/models"
22
+ ```
Original file line number Diff line number Diff line change @@ -27,12 +27,13 @@ import (
27
27
"github.com/zieckey/goini"
28
28
)
29
29
30
- // TODO(saeta): Add a GCE compatible environment.
31
-
32
30
const appDefaultFile = "application_default_credentials.json"
33
31
34
32
func gcloudConfig () (* Config , error ) {
35
33
homedir := ""
34
+ if configDir , ok := os .LookupEnv ("CLOUDSDK_CONFIG" ); ok {
35
+ return buildGcloudEnvConfig (configDir , true )
36
+ }
36
37
user , err := user .Current ()
37
38
if err != nil {
38
39
// Fallback to looking up in the environment as a final attempt.
Original file line number Diff line number Diff line change 16
16
package config
17
17
18
18
import (
19
+ "os"
19
20
"path"
20
21
"strings"
21
22
"testing"
@@ -46,6 +47,39 @@ func TestGcloudClean(t *testing.T) {
46
47
}
47
48
}
48
49
50
+ func TestGcloudEnvConfigOverride (t * testing.T ) {
51
+ cfgDir := testGcloudConfigDir ("clean" )
52
+ originalEnv , originalEnvOk := os .LookupEnv ("CLOUDSDK_CONFIG" )
53
+ defer func () {
54
+ // Attempt to set the original env back.
55
+ if originalEnvOk {
56
+ os .Setenv ("CLOUDSDK_CONFIG" , originalEnv )
57
+ }
58
+ }()
59
+
60
+ if err := os .Setenv ("CLOUDSDK_CONFIG" , cfgDir ); err != nil {
61
+ t .Fatalf ("Could not set the env: %#v" , err )
62
+ }
63
+ cfg , err := gcloudConfig ()
64
+
65
+ if err != nil {
66
+ t .Fatalf ("Error creating config: %v" , err )
67
+ }
68
+
69
+ if cfg .ActiveConfiguration != "ctpu9" {
70
+ t .Error ("Active configuration: " + cfg .ActiveConfiguration )
71
+ }
72
+ if cfg .
account != "[email protected] " {
73
+ t .Error ("Account: " + cfg .account )
74
+ }
75
+ if cfg .Project != "ctpu9-test-project" {
76
+ t .Error ("Project: " + cfg .Project )
77
+ }
78
+ if cfg .Zone != "us-central1-c" {
79
+ t .Error ("Zone: " + cfg .Zone )
80
+ }
81
+ }
82
+
49
83
func TestGcloudCorruptedMissingConfig (t * testing.T ) {
50
84
cfgDir := testGcloudConfigDir ("corrupted" )
51
85
_ , err := buildGcloudEnvConfig (cfgDir , true )
You can’t perform that action at this time.
0 commit comments