DevilKing's blog

冷灯看剑,剑上几分功名?炉香无需计苍生,纵一穿烟逝,万丈云埋,孤阳还照古陵

0%

原文链接

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
language: go

go:
- "1.8"

before_install:
- echo "before_install"

install:
- echo "install"
-
before_script:
- echo "before_script"

script:
- echo "script"

travisci steps

关于Job的定义,Job 就是一個歷經 TravisCI 生命週期所有步驟的基本單位。

关于Custom job的实现

custom job

引入job:include的概念

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
language: go

go:
- "1.8"

before_install:
- echo "before_install"
install:
- echo "install"
before_script:
- echo "before_script"
script:
- echo "script"

jobs:
include:
- stage: Custom Testing
name: Unit-Testing
go: "1.8"
script: echo "unit script"
- name: Integration-Testing
before_install: "Integration-Testing_before_install"
go: "1.9"
script: "Integration-Testing_script"

Stage 的特色以及概念如下

  1. 由一群 Job 組成
  2. 只要有一個 Job 失敗,該 Stage 就會被視為失敗
  3. 只有當該前 Stage 是成功的狀態,才會執行下一個 Stage

多个stage

有效建模的要素:

  • 模型和实现的绑定
  • 获得了一种基于模型的语言
  • 开发一个蕴含丰富知识的模型
  • 提炼模型
  • 头脑风暴和实验

原文链接

从一个需求开始

I want to be able to assign the account manager to the user who is my client.

solution way

  • First of all we need to stop thinking in a CRUD way

    化身领域的方式来进行,思考namespace,module部分,

  • action name

1
app/contexts/authentication` or `app/domains/authentication

关于context或者说domain的设置部分

DDD blue book

如果再也见不到你,我再祝你早安、午安、晚安

困于自己的牢笼,还是去继续探索世界


本周工作:

  • 进行提测
  • 新的feature_graph脚本的讨论

本周所得:

  • demo day的恢复
  • 相关流程的熟悉
  • 熟悉了一些k8s的命令

下周工作:

  • 支持提测,修复相关的bug
  • 无时间列的情况
  • 调研新版的fe脚本部分

第一版终于是提交了,算是开了一个头,不过感觉还是做的像个玩具一样。。。效果什么的,操作上什么的,感觉还是比较业余。希望后面能够做的越来越专业吧,希望自己能够往更上一点的架构层次上去想一想,每次重构一点代码,每次学习一点东西

谁给你的自信,能够让你放松。。。无论是生活还是工作。。。秉持正念,苦行僧。。。

前头还说按部就班,后面感觉自己就放松了一些,还是要找到方向,找到持续学习的地方。。。

在生活上,也放松了对自己的要求,不要轻易破坏自己的一些想法和一些原则,虽然看起来是那么可笑以及幼稚,但其实是自己刺猬的一种方式,缩在自己的套中。。。

按照基本的要求去规范自己,不要偷懒,也不要过多地牵扯太多,珍惜这样的时光,但也不想失去自己。。。

锻炼部分,又偷懒了,还是慢慢恢复吧,下午的晚饭,忍住不要吃了。。。看能否抵挡一些脂肪

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
@Slf4j
public class URLClassLoaderTest {
private static final String remoteJarPath = "http://localhost:8080/operators/base-operator.jar";
@Test
public void testLoadRemoteJar() throws Exception {
URI uri = new URI(remoteJarPath);
URLClassLoader classLoader = new URLClassLoader(new URL[]{uri.toURL()});
Thread.currentThread().setContextClassLoader(classLoader);
ServiceLoader<Operator> loader = ServiceLoader.load(Operator.class);
Iterator<Operator> iterator = loader.iterator();
while (iterator.hasNext()) {
try {
Operator operator = iterator.next();
log.info("OperatorInfo: name={}, platform={}", operator.getName(), operator.getPlatform());
} catch (Exception e) {
log.warn("Failed to instantiate operator", e);
}
}
}
}

以代码为例说明:

  • 采用URLClassLoader的方式来加载jar包
  • 在此基础上,加入SerivceLoader来加载类Operator的class

关于URLClassLoader部分

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.jcg;

/**
* @author ashraf
*
*/
public class Bean {

public void sayHello() {
System.out.println("Hello from loaded Bean class !!!");
}

}




package com.jcg;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;

/**
* @author ashraf
*
*/
public class URLClassLoaderTest {

/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {

// Getting the jar URL which contains target class
URL[] classLoaderUrls = new URL[]{new URL("file:///home/ashraf/Desktop/simple-bean-1.0.jar")};

// Create a new URLClassLoader
URLClassLoader urlClassLoader = new URLClassLoader(classLoaderUrls);

// Load the target class
Class<?> beanClass = urlClassLoader.loadClass("com.jcg.Bean");

// Create a new instance from the loaded class
Constructor<?> constructor = beanClass.getConstructor();
Object beanObj = constructor.newInstance();

// Getting a method from the loaded class and invoke it
Method method = beanClass.getMethod("sayHello");
method.invoke(beanObj);

}

}

见上面的例子,利用反射的方式?